Комментарии:
An easy improvement is to create the page when it is first used. Implementing the MainWindow.show_frame() as such allows the list of all the pages to be eliminated and just added to as needed:
def show_frame(self, page):
if page in self.frames:
frame = self.frames[page]
else:
frame = page(self.container, self)
self.frames[page] = frame
frame.grid(row=0, column=0, sticky="NSEW")
frame.tkraise()
If I had entry widgets in one or either of the child frames, how do I retrieve the variable in the parent frame?
Ответитьhello what if i need to put the "show_frame call" inside a method and not inside the button comment. i cant make it work
Ответитьobviously i'm watching this almost a decade later so you've probably already streamlined this since you made this vid, but feel like i should mention making a parent class for 'Page' that contains all the duplicate code and then just inheriting that template class to PageOne, PageTwo, etc. would be a lot simpler
ОтветитьThank god you got it done buddy... Thank you so much for this. I wish someday I can be like you and help others like you just did.
ОтветитьHi Harrison! thank you so so much for this detailed tutorial
do you have a github directory for this project? so i can see your modules and overall structure? i'm trying to code a program for my lab and this is my first big code project so im totally lost with the design
For me it says that controller is undefined... Can you help?
ОтветитьEverythin's nice and simple, but how can I give static caracteristics for each window like geometry, title, etc?
ОтветитьI got this error inside the for F in(PageOne,PageTwo):
self.frames[F]=frame
TypeError: list indices must be integers or slices, not type
Super
Ответитьholy shit this is actually so good xD doing a simulation software for university right now and this will help me so much, thank you :)
ОтветитьBeginner Pythoner here. Quick question about OOP - why are we creating different pages as separate classes instead of creating a Page class and then instantiating page objects? or am I not thinking about this correctly?
ОтветитьNot sure if you'll see this but how do you set the window size of each individual frame, as my frames are different sizes, and currently they are all as big as the biggest frame.
ОтветитьFirstly thank you, I've been trying to learn Tkinter but most of the documentations that were outlined on wiki.python were just outlining its widgets and their code without much on navigating different pages or best practices when using classes.
Could you share which Tkinter documentation has been the most comprehensive when you were learning, especially when it came to navigating different pages and general best practices.
How to put image in frames using your aproch, i tried everything please help
Ответитьhow to key bind like this, root.bind("<Return>", func)
i am unable to key bind please help anyone
This was super helpful, thank you! Just a heads up, I think you should probably add a note to the start of the video that the last two videos in this playlist are needed to understand what's going on here. I found your video by looking up how to make an app with multiple windows and that's really fully explained in this and the last two vids.
ОтветитьMan, the way your code make me headache
Ответитьthis helped me a lot just one thing though , using this code how do i use my own images as buttons instead of a standard button? thanks!
Ответитьhow can we change the window title here?
ОтветитьHow to add background?
Ответитьanyone know how to create an exit button for this code? or link the video where he does?
ОтветитьI'm sorry, but why do you have to create a separate class for every page ? i mean why not just write one piece of code that generates pages for you instead?
ОтветитьThank you!
The idea was awesome!
How to change the size of a frame
"I've used Width and height options , but no change ..." Any help!!
6 years later i know ... but, is there a way to have all those classes in different files ?
I mean, for a "big" project, it won't be "clean" to have ALL the code's lines in one file.. :x
(sry for my english, not native)
Your videos are wonderful. I want build a music player in tkinter with pygame. I am stuck on implementation of seek feature on the player. Any ideas please
ОтветитьExcellent presentation. You saved me so much time.
Ответитьhow do i resize the frame for every page?
ОтветитьWhen switching between windows, how do you make it so the window resizes to fit the new class each time?
Ответитьhow do i change color of background ?
ОтветитьHi , could you please explain , how to set opened window name for the same program in video.? Thanks in advance
ОтветитьWhy does it keep saying I'm missing 2 required positional arguments?!
ОтветитьThanks a lot.
Ответитьwhat if i want to have two frames in one window and i have to fix one frame which has buttons and other frame has to change every time i click a button on first frame.
ОтветитьSir, is there any possibility without using any button to open one window to another window??
Ответитьhow do you get a string entered in the entry widget in Start Page to a variable in PageOne
ОтветитьShouldn't the container in the class he defined in the first video be an attribute of the class ?
ОтветитьHow do you put a background image when doing it like this?
Also how to set a title when not using variables?
Thanks genius for helping me out😊😊
Ответитьhow to set title in this program
ОтветитьWhich is the part of the code that restricts me from using the packing method grid()?
ОтветитьHow can i make the screen full size with this method. I tried using the geometry object but I didn't work. I am new at this, so any help will be appreciated.
ОтветитьQuestion!
How can i put an image background using this method of class definition for each window??????
sentdex u look so frickin different
ОтветитьNice guide! Thanks, it helped a lot
But i still have problem. I am trying to build multitab application, where each page is a different graph, for example: page1- temperatures , page 2 -windrose and so on. I wanted to ask you how i can generate different graphs on demand? Thank u in advance