new tab in tkinter

Solutions on MaxInterview for new tab in tkinter by the best coders in the world

showing results for - "new tab in tkinter"
Emilia
17 Jul 2019
1from tkinter import *
2from tkinter.ttk import Notebook		# import Notebook
3
4# create new window
5root = Tk()
6
7# create tabcontrol 
8tabcontrol = Notebook(root)
9
10# create a number of tabs you want to add
11tab1 = Frame(tabcontrol)
12tab2 = Frame(tabcontrol)
13
14# add the tabs to the tabcontrol
15tabcontrol.add(tab1, text='This is Tab 1')
16tabcontrol.add(tab2, text='This is Tab 2')
17
18# grid the tabcontrol
19tabcontrol.grid(column=0, row=0, padx=100, pady=100)
20
21root.mainloop()
22