Python Tutorial: GUI Calculator with Model View Controller #7

preview_player
Показать описание
In this part we begin implementing the model that will calculate the result based on the command passed by the controller.

The complete series will show you how to code a fully functioning simple calculator from scratch using the tkinter graphical user interface library. Tkinter comes preinstalled when you download Python. You will also get an idea of what it is like to code in the style of model view controller.

Рекомендации по теме
Комментарии
Автор

wow you are making complicated stuff easy! loved the way you make the callback method using a lambda! super cool way

FunnyVideos-niiu
Автор

Thanks for your outstanding Videos! Its the best series on mvc in python I found so far! I'd love to see more in-depth tutorials by you! Subbed :)

xNN
Автор

In MVC, the view should not know the controller exists. Binding the button command to Controller.on_button_click() from inside the view class violates this principle. The command binding should be done in the controller class. I got around this by creating a list of the buttons as an instance variable in the view class, then creating a bind method in the controller that used Button.config(command=) to add the command after the buttons were instantiated. Now the view is decoupled from the controller and the controller handles all actions. I hope this helps anyone that is confused here.

markm
Автор

Extremely confusing tutorial. No thorough explanation given. No wonder it has very minimal views.

timtech