Python Forum
[Tkinter] Return a value to __main__
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Return a value to __main__
#8
Thee parts, not classes. There might be lots of classes or no classes, but the division of labor is three parts. I will use the Model View Controller paradigm

You have a Model part. In my line of work my Model is a piece of machinery that my application controls. In Microsoft Word the model is a document. Model is the most important part. In my example, time.time() was the model. Not a very interesting model because I cannot change the state of the clock. For my professional work the Model is about 70% of the code.

The View is the presentation of the information. This is your GUI

The controller accepts input from the user and serves as the glue between the Model and View. In my example the controller was partially implemented in tkinter and partially in the Glue class. The controller part is usually messy when compared to the Model and View. As it is the thing that binds them together, the controller has information about the model and the view. Much work in user interface design is focused on making the controller less messy.

For simple programs it is often easiest to put MVC all in one class. This doesn't hold up well as the model and view grow in complexity.
Reply


Messages In This Thread
Return a value to __main__ - by menator01 - Mar-27-2022, 03:58 AM
RE: Return a value to __main__ - by Coricoco_fr - Mar-27-2022, 06:54 AM
RE: Return a value to __main__ - by menator01 - Mar-27-2022, 07:08 AM
RE: Return a value to __main__ - by Coricoco_fr - Mar-27-2022, 07:52 AM
RE: Return a value to __main__ - by menator01 - Mar-27-2022, 08:06 AM
RE: Return a value to __main__ - by deanhystad - Mar-27-2022, 04:58 PM
RE: Return a value to __main__ - by menator01 - Mar-27-2022, 05:10 PM
RE: Return a value to __main__ - by deanhystad - Mar-27-2022, 05:29 PM

Forum Jump:

User Panel Messages

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