我试着写一个程序,你在一个输入框里输入一个数字,点击一个按钮,它就会打印出你输入的数字,它会打印出你输入的数字乘以0.008。在
然后存储这些数字,以便下次您输入一个数字时,它会将它添加到上一个数字中并打印出来,以此类推。我已经写了第一段代码,它运行得很好。但我不知道该怎么做。这是我目前为止的代码。在
from tkinter import *
def calculatemoney():
done = float(Lines1.get())
salary3 = done * 0.08
salary4 = done * 1
labelresult = Label(root, text='%.0f' % salary4).grid(row=3, column=2)
labelresult = Label(root, text=' £ %.2f' % salary3).grid(row=4, column=2)
root = Tk()
root.title('Dict8 Calc')
root.geometry('250x200+800+100')
Lines1 = StringVar()
var1 = Label(root, text='Enter Lines').grid(row=0, column=1)
var2 = Label(root, text='Lines Today').grid(row=3, column=1)
var3 = Label(root, text='Money Today').grid(row=4, column=1)
var4 = Label(root, text='Lines Total').grid(row=6, column=1)
var5 = Label(root, text='Money Total').grid(row=7, column=1)
myLines = Entry(root, textvariable=Lines1).grid(row=0, column=2)
button1 = Button(root, text=' Calculate ', command=calculatemoney).grid(row=8, column=2)
root.mainloop()
是什么阻止了你使用正则变量?在
相关问题 更多 >
编程相关推荐