11. Tkinter: Notebook

Subscribers:
5,850
Published on ● Video Link: https://www.youtube.com/watch?v=oyVT7o6fP68



Duration: 4:09
391 views
0


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)







Tags:
tkinter
python
intro
introduction
tutorial
keyboard
notebook
scroll
text
entry
buttons
radio
combo
checkbox
scales
sliders