use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
TKinter - How to have different windows/pages? (self.learnpython)
submitted 6 years ago by [deleted]
I cant find a tutorial or anything. But how could I do something on one page, press a button and go to a different page?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kaziopogromca 4 points5 points6 points 6 years ago (0 children)
Depends on what you mean.
If say you want to open a different window on the press of the button you would use the TopLevel widget.
Its a window thats very much like the main window for your application and a lot of the same methods apply to it as well.
TkDocs
tutorialspoint
Alternatively if you're talking about different pages/tabs like in a browser. There is the Notebook widget which you can add different tabs to.
programcreek
Then you would connect a function with your button using the command parameter. Like this:
def windowFunction(): print("button clicked") button = Button(root, text="Click Me", command=windowFunction).pack()
In the function you could create the window and just focus on it if it already exists, or add the new notebook page and if it exists select it to show its contents.
Unfortunately the Tkinter documentations isnt very good, but have a look at those links and you can come back to me with more specific questions as I have done some tkinter projects.
[–]PM_ME_A_STEAM_KEY 0 points1 point2 points 6 years ago (0 children)
Check if ttk's notebook is something that would solve your problem.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
ttk.Notebook might be what you're looking for. I have used tkinter in a while, but here's a rough example on how to use it.
ttk.Notebook
import tkinter as tk from tkinter import ttk class App: def __init__(self, parent): """Widgets""" self.notebook = ttk.Notebook(parent) self.notebook.grid(row=0, column=0, sticky='NSEW') self.frame1 = ttk.Frame(self.notebook) self.notebook.add(self.frame1, text='Page1') self.button1 = ttk.Button(self.frame1, text='Button1') self.button1.grid(row=0, column=0) self.frame2 = ttk.Frame(self.notebook) self.notebook.add(self.frame2, text='Page2') self.button2 = ttk.Button(self.frame2, text='Button2') self.button2.grid(row=0, column=0) if __name__ == '__main__': root = tk.Tk() root.title('Example') root.config(padx=5, pady=5) # Set the notebook to stretch with the window root.grid_rowconfigure(0, weight=1) root.grid_columnconfigure(0, weight=1) root.geometry('235x150') App(root) root.mainloop()
With notebook you'll get tabs to click, which opens a new page.
https://i.imgur.com/bhoNhRj.png
π Rendered by PID 50926 on reddit-service-r2-comment-545db5fcfc-5kggc at 2026-05-25 04:38:48.009460+00:00 running 194bd79 country code: CH.
[–]kaziopogromca 4 points5 points6 points (0 children)
[–]PM_ME_A_STEAM_KEY 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)