new tab in tkinter code example

Example: new tab in tkinter

from tkinter import *
from tkinter.ttk import Notebook		# import Notebook

# create new window
root = Tk()

# create tabcontrol 
tabcontrol = Notebook(root)

# create a number of tabs you want to add
tab1 = Frame(tabcontrol)
tab2 = Frame(tabcontrol)

# add the tabs to the tabcontrol
tabcontrol.add(tab1, text='This is Tab 1')
tabcontrol.add(tab2, text='This is Tab 2')

# grid the tabcontrol
tabcontrol.grid(column=0, row=0, padx=100, pady=100)

root.mainloop()