我正在制作一个GUI来比较用户输入的两个变量,但是当我输入数字并按下按钮时没有任何事情发生(没有输出)
listOfNum.stream().map(integer -> integer.toString()).collect(Collectors.toList());
答案 0 :(得分:0)
节目结束了谢谢。
from tkinter import *
from tkinter import ttk
root = Tk(className = "biggerOrLess")
ttk.Label(root, text="Compare two numbers").grid(row=0)
txt = StringVar()
def updatelabel(result):
txt.set(result)
Lab = ttk.Label(root, textvariable=txt).grid(row=3)
def biggerOrLess(x,y):
try:
x = UIP.get()
y = UIP2.get()
x = float(x)
y = float(y)
if x == y :
result = (x, " = " ,y)
elif x > y :
result = (x," > ",y)
elif x < y :
result = (x," < ",y)
updatelabel(result)
except:
updatelabel('wrong input')
UIP = Entry(root,)
UIP2 = Entry(root,)
UIP.grid(row=2)
UIP2.grid(row=4)
B1 = Button(root, text = 'Compare', command = lambda :biggerOrLess(UIP, UIP2))
B1.grid(row=3, column=2)
root.mainloop()