Advertisement
c0d3dsk1lls

Create Tabs CodedSkills.net

Aug 3rd, 2022 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. #===========================================================================================
  2. #--Create tabs---------------------------------------------------------------------------------
  3. from tkinter import *
  4. from tkinter import ttk
  5. window = Tk()
  6. notebook = ttk.Notebook(window) #widget that manages a collection of windows/displays
  7. #-------------------------------------------
  8. tab1 = Frame(notebook) # new frame for tab 1
  9. tab2 = Frame(notebook) # new frame for tab 2
  10. #-------------------------------------------
  11. notebook.add(tab1,text="Tab 1")
  12. notebook.add(tab2,text="Tab 2")
  13. notebook.pack(expand=True,fill="both") #expand = expand to fill any space not otherwise used
  14. #-------------------------------------------
  15. Label(tab1,text="Hello, This is tab #1",width=50,height=25).pack()
  16. Label(tab2,text="Goodbye, This is tab #2",width=50,height=25).pack()
  17. #-------------------------------------------
  18. window.mainloop()
  19. #-----------------------------------------------------------------------------------
  20. #=============================================================================================
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement