Samrath Chadha
Samrath Chadha

Reputation: 27

How to change the content of a tkinter window?

How can I change my Tkinter window's content? Like a webpage where you click buttons to go to different places?

(Preferably without classes)

Upvotes: 0

Views: 912

Answers (1)

TheFluffDragon9
TheFluffDragon9

Reputation: 524

Your question is quite vague, but I believe the ttk.Notebook widget may be of use. Here is an example of how to have different tabs of content:

from tkinter import *
from tkinter.ttk import *

root = Tk()
tabmanager = Notebook(root)
tabmanager.pack(expand=1,fill="both")

tab1 = Frame(tabmanager)
tab2 = Frame(tabmanager)

tabmanager.add(tab1,text="Home")
tabmanager.add(tab2,text="About")

root.mainloop()

You can then add whatever widgets you like to the frames. Hopefully this answers your question; let me know if you need more help :)

Upvotes: 1

Related Questions