实际上,我有两个问题。第一个问题是,如何用组合框替换列表框?第二个问题,我希望用户看到dic键但是使用该值的函数,我该怎么做?
onUnchecked
答案 0 :(得分:0)
在您的情况下,您可以将l1
定义为:
# Read-only combobx with choice values (50, 80)
l1 = ttk.Combobox(aken, values=[50, 80], state='readonly')
# Select the first item of the combobox by default
l1.current(0)
然后在您的calculate()
方法中:
def calculate():
# Get current value selected in the combobox and convert it to float
a = float(l1.get())
...