In this video series we use the Python graphical user interface module known as Tkinter to generate a four function calculator! The best way to learn a practical example of programming in python is to combo it with a functional application by creating a good GUI to display the functionality!
This is Episode 2 and covers all the functions required to make our calculator fully functioning! We start by defining the function to add characters to the numerical values 0-9 plus a decimal point, then we create the function to receive an operator input, followed by the function to execute the math when the equals button is pressed, and finally the clear function to revert everything to its starting state! Tkinter GUIs require some specific syntax to update a text input or label using the StringVar() properties so we cover that here as well!
Episode 1 in the series covered defining all the numerical buttons as well as the mathematical buttons to serve as the application's inputs, and creating the text box label for displaying the operations and answers as they execute. The widgets are all defined and then placed into a grid layout, and then we show how to use tkinter's 'sticky' functionality to create an app that fills the available window and is resizable!
If you found this or anything else on the channel useful be sure to leave a like and subscribe to LeMaster tech for tons of other tutorials and exercises! Leave a comment if there is anything specific you have questions on, or anything you'd like to see on the channel in the future!
Previous video in the series:
• Build a Calculator in Python Using Tk...
Thanks for watching and good luck with your code!
Watch video Build a Calculator in Python Using Tkinter! GUI Tutorial #2. Code the Functions and Update Outputs! online without registration, duration hours minute second in high quality. This video was added by user LeMaster Tech 16 November 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 622 once and liked it 15 people.