Mar-27-2018, 11:44 AM
(Mar-27-2018, 11:12 AM)Larz60+ Wrote: self is an instance of itself, in your case TopLevelWindow
when you call __init__, you are passing top1 which is an instance of TopLevel, width of 300, and height of 300.
If you passed root instead of top1, there would only be one window.
you can also 'hide' the root window with root.withdraw()
Toplevel creates a new 'root like' window in addition to root
Once top1 is passed to TopLevelWindow, it becomes self.master or TopLevelWindow.master, but it's still the same instance of top1
Then you create yet another instance of TopLevelWindow passing top2 as master
you could of also instantiated TopLevelWindow this way, which may explain a bit more:
TopLevelWindow(master=top1, width="300", height="300")I try to do this by default, but when cranking out code, often miss doing it. It explains what's what with a single glance.
Hi Larz, thank you very much for the explanation. I think the main thing that's important here is that this seems a legitimate way of creating multi toplevel windows without breaking anything else in Python haha
I can now move forward with my project.