First a note about coding style.
Using global statements outside of a class is better done using a function, generally placed at the end of your script.
Placing it all at the top of the script makes it ugly, and difficult to read.
General suggested script structure:
Using global statements outside of a class is better done using a function, generally placed at the end of your script.
Placing it all at the top of the script makes it ugly, and difficult to read.
General suggested script structure:
- imports
- class definitions
- Dispatcher (outside of class, at bottom of script)
this is a function that:- Collects and passes needed arguments for clases used
- Instantiates needed classes with collected argument data.
- any external processing, like mainloop for tkinter
- Collects and passes needed arguments for clases used
- An entry that will allow the script to be executed on its own,
without interfering with the ability to import from another script.
this usually is something like this:
if __name__ == '__main__': dispatch()
dispatch can be replaced with your dispatcher function name.