How to create a basic calculator using Tkinter. First we will import all files from tkinter . Tk():It is GUI toolkit available on windows system as well as other platforms. The next step is we, Defining the geometry of the tkinter window Defining the title of tkinker window here i have taken me.geometry Let's see here, what we have on next step StringVar(): This is a class used to monitor changes to the Tkinter variable. We can create an instance of it to use it. Next Step, This Defines the function for click event Here for different operators we use func to define buttons ,that what they have to do we make some functions for the respective buttons. Entry: This widget provides a text box to the user. It accepts single-line string input from the user. This widget can only be used for one line of text from the user. pack(): This method with the screen is used to organize the geometry of widget in blocks after placing in parent widget i.e it act as a geometry manager. ipady: This defines a number of pixels to pad widget, horizontally, and vertically. But only inside the widget’s border. bg: To set the background color. It allows to create small, inline functions for the command parameter. We have three buttons that share one callback. The lambda function allows us to send specific data to the callback. mainloop():This is like infinite loop used to run the application. It's basically waits for an event to occur as long as the window is not closed.
-
Notifications
You must be signed in to change notification settings - Fork 2
ysriv/Trinkter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published