Last 3 weeks I have been busy with Tkinter. It is a python library for the graphical interfaces. I used lots of widgets in order to create nicely viewed pages.
separate pages, tabbed ( it is also called notebook) pages and etc.
In order to create such a page and propose to the end user with the lots of functionality I choose Model View Controller architecture. And for myself ro easily dominate my code
I will give a brief explanation about MVC ( how it works) and tips about tkinter that you have to remember when you create pages.
1. model () : this class only contains the DATA, what you wanna show on the view or the input data for the computations and so. it is passive
2. controller( model) : this class is able to communicate with model ( lets say it can see the model class) and it controlls which data will be used for which purpose. it is active
3.view ( controller, model): it is as it is understood from the name of it is the view, visual appearance. It communicates with model and controller. when user press something controller takes the role and do whatever it hs to do . Lets say user fill some inputs and press compute then, view send the data to the model and call the controller. then the controller gets the data from the model and does the necessary computations. and let the view knows from the result ( if it is required)
Tip about Tkinter….
For the structured places of the widgets two methods are used. GRID and PACK….
for the same frame never ever use pack an grid together. your source code can be compiled but it will never work 🙂 dont try to find the error bcause it is not syntax error it is logical error for the tinter :d
so far i can give that much info. I wish I had lots of time to write everything what I know.
I am so thankful to the people who publish USEFUL bolgs for us, and give chance to improve ourselves withut spending plenty of time to figure out the problem by ownselves…