June 27th, 2005, 07:37 PM
Creating additional windows with python+tkinter
Hello. I'm going through "Learning Python" and "Programming Python" both by O'Reilly. I'm trying to create a fairly simple program. I have a main file "login.py" which asks for a username and then I want it to open up another window where the majority of the program will be. What is the best way to do this? Would it be easiest to create separate .py files/programs for each of the windows I'm going to need? Thanks in advance!
June 28th, 2005, 06:46 AM
I'm sure you will get a lot of advice on this one - here's mine
If your program is going to have several dialogs it is a good idea to put each dialog in it's own module - particularly if there will be some event code to process user actions. This will have a benefit in that it forces some structure to your coding. It's good practice even if the code in each module is small.
Define a module that imports the other modules. This would normally be the main entry point of the program so you can call it login.py. The main module does not have to have GUI stuff at all it can just co-ordinate the other modules that do have GUI stuff (like a module for your login dialog).
Define a module for the frequently used but small chunks of code for things like error reports or yes/no dialogs.
June 28th, 2005, 12:35 PM
How about using classes as well very helpful
and ofcourse you would use a login in window and then a executtion window.
But make it so that the login is a toplevel widget in Tkinter depends
Those people who think they know everything are a great annoyance to those of us who do.
June 29th, 2005, 10:16 PM
Ok, thanks for the suggestions. I'll look into it.