In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces Python+tkinter how to achieve calculator function related knowledge, content detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone reading this Python+tkinter how to achieve calculator function article will have some gains, let's take a look at it.
renderings
code
from tkinter import * reset=True def buttonCallBack(event): global label global reset num=event.widget['text'] if num=='C': label['text']="0" return if num in "=": label['text']=str(eval(label['text'])) reset=True return s=label['text'] if s=='0' or reset==True: s="" reset=False label <$'text ']=s+num #Main window root=Tk() root.wm_title("Calculator") #Display column 1 label=Label(root,text="0",background="white",anchor="e") label <$'width']=35 label <$'height ']=2 label.grid(row=1,columnspan=4,sticky=W) #Button showText="789/456*123-0.C+" for i in range(4): for j in range (4): b=Button(root,text=showText[i*4+j],width=7) b.grid(row=i+2,column=j) b.bind ("",buttonCallBack) showText="()" for i in range(2): b=Button (root,text=showText[i],width=7) b.grid (row=6,column=2+i) b.bind ("",buttonCallBack) b=Button (root,text="=") b.grid(row=6,columnspan=2,sticky="we") b.bind("",buttonCallBack) root.mainloop() About "Python+tkinter how to implement calculator function" This article is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "Python+tkinter how to realize calculator function." If you still want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.