Python Forum
Larger GUI Program Oraganisation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Larger GUI Program Oraganisation
#1
Hello,

I am just about to write a large tkinter GUI program and I would like to ask a bit of advice on layout organisation before I start. I would like to start with a good design mythology that is upgradeable and enables easier debugging and also isn't memory hungry.

The GUI interface will include about 25 buttons, 50 dialog boxes, 10 progress bars and a field for saving the data to a file. So keeping things simple i will base it on a car, and list all the py files below:


* main.py - this will include all, botton clicks, dialog boxes, basic operations and external function file function calls.

* engine.py - includes functions to sends and receives data to the engine.

* gearbox.py - includes functions to sends and receives data to the gearbox.

* cabin.py - includes functions to sends and receives data to the cabin.

* savedata.py - saves data to an external file


Essentially I don't want main.py to end up being 10 A4 pages long and a complete mess and a nightmare to debug. Would you recommend putting more of the main.py function into external files?

Look forward to your reply and any feedback.

Tuurbo46
Reply
#2
50 dialog boxes sounds like a lot for an application. Maybe it makes sense for your application, but usually it is better design to stick to one main view so the user does not have to look from window to window or keep track of windows, or have not all information available because windows are modal and none show all information at the same time.

It is always a good idea to separate business logic from view code. How many files are needed for the business logic really depends on how the logic is related. If it cleanly breaks up into 3 well defined modules, then have 3 modules. If you find that each part depends on knowing about all the other parts, don't think that you need to divide into multiple files just because the function count is getting high.

Having save/restore data in a separate module might make sense, or it might make sense to have save/restore be attributes of your data models.
Reply
#3
Here’s a approach you can try out,
Split by functionality, not just by file count, separate modules (e.g., engine.py, gearbox.py, cabin.py, savedata.py) makes sense if each really encapsulates a distinct part of the logic..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Figure Gets Larger Every time I click a show button joshuagreineder 2 2,865 Aug-11-2022, 06:25 AM
Last Post: chinky

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020