11. Tkinter: Notebook
Video code
from tkinter import*
from tkinter import ttk
currentTab = 0
def mKey(event):
global currentTab
if currentTab == 2:
currentTab=0
else:
currentTab = currentTab+1
Notebook.select(currentTab)
master=Tk()
master.title("My title")
master.configure(background='white')
master.geometry("350x200")
master.bind('m',mKey)
style = ttk.Style()
style.layout('TNotebook.Tab',[])
Notebook = ttk.Notebook(master, width = 400)
Tab1 = ttk.Frame(Notebook)
Notebook.add(Tab1, text="Show items")
Tab2 = ttk.Frame(Notebook)
Notebook.add(Tab2, text="Edit items")
Tab3 = ttk.Frame(Notebook)
Notebook.add(Tab3, text="Delete items")
Notebook.pack()
#Tab1
Tab1Label = Label(Tab1,text="This is tab 1")
Tab1Label.pack(side=TOP)
#Tab2
Tab2Label = Label(Tab2,text="This is tab 2")
Tab2Label.pack(side=TOP)
Other Videos By Game Design with Reilly
2020-04-29 | 3. JavaScript: Code Comments |
2020-04-29 | 2. Javascript: Variables |
2020-04-29 | 1. JavaScript: Outputs |
2020-04-22 | 18. Tkinter: Scales / Sliders |
2020-04-22 | 17. Tkinter: Combo Box |
2020-04-22 | 16. Tkinter: Checkboxes |
2020-04-22 | 15. Tkinter: Radio buttons |
2020-04-22 | 14. Tkinter: Text Entry |
2020-04-08 | 13. Tkinter: ScrollText |
2020-04-08 | 12. Tkinter: Notebook and keyboard inputs |
2020-04-08 | 11. Tkinter: Notebook |
2020-04-08 | 10. Tkinter: Keyboard input |
2020-04-08 | 9. Tkinter: Looping a grid |
2020-04-01 | 8. Tkinter: Frames |
2020-04-01 | 7. Tkinter: Place Layout |
2020-04-01 | 6. Tkinter: Grid Layout |
2020-04-01 | 5. Tkinter: Side Layout |
2020-04-01 | 4. Tkinter: Widget Functions |
2020-04-01 | 3. Tkinter: Widgets |
2020-04-01 | 2 Tkinter: First window |
2020-04-01 | 1 Tkinter: Introduction |