PYTHON TKINTER:TypeError:只能将str(而不是“ Spinbox”)连接到str

时间:2019-12-04 20:35:58

标签: python tkinter concatenation

我正在尝试将Spinbox值分配为整数变量

def create_window3(beer,bottle_num):
    x = datetime.now()
    current_month = x.strftime("%b")
    window3 = Tk()
    window3.title("3")
    L1 = Label(window3, text="The month is"+current_month+"Your order of"+bottle_num+"ml of"+beer+"is now entering Hot Brew...")
    button1 = Button(window3, text='continue ', command= lambda: fermentation(beer,bottle_num))
    L1.pack()
    button1.pack()


window2 = Tk()
    window2.title("Choose Quantity")
    L1 = Label(window2, text="How many ml of"+value+"would you like?")
    S1 = Spinbox(window2, from_=0, to=10000000)
    listbox = Listbox(window2, height=10,width=100)
    button1 = Button(window2, text='continue', command= lambda: create_window3(value,S1))
    L1.pack()
    S1.pack()
    listbox.pack()
    button1.pack()

我明白了: Tkinter回调中的异常 追溯(最近一次通话):   调用中的文件“ C:\ Use $$$ Python \ Python37-32 \ lib \ tkinter__init __。py”,行1705     返回self.func(* args)   文件“ C:\ $$$,第82行,在     button1 =按钮(window2,text ='continue',command = lambda:create_window3(value,S1))   在create_window3中,文件“ C:\ Users \ $$$,第70行”     L1 =标签(window3,text =“月份为” + current_month +“您的” + bottle_num +“ ml的” +啤酒+“的订单现在正在进入Hot Brew ...”) TypeError:只能将str(而不是“ Spinbox”)连接到str

0 个答案:

没有答案