我有一个tkinterLabel
小部件,用于在新窗口中显示查询结果。我想根据查询选择在同一标签中显示两个内容
这是我的密码:
Label(newWindow, textvariable=selected_diff + " Hikes in " + selected_park, width=50,
fg="black", font=("bold", 12), bd=1, relief="raised").grid(row=0, column=3)
我知道我可以只创建3个独立的Label
,但我认为这看起来很糟糕,而且很粗糙
这是我的回调错误-我猜您不能使用+在同一个小部件中连接str
和StringVar
?似乎不太可能-更有可能是我做了一些格式错误
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\mount\anaconda3\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "F:/PycharmProjects/SIE557_2021_FP/fp_comboboxes.py", line 289, in search_hikes
Label(newWindow, textvariable=selected_diff + " Hikes in " + selected_park, width=50, fg="black", font=("bold", 12), bd=1, relief="raised").grid(row=0, column=3)
TypeError: unsupported operand type(s) for +: 'StringVar' and 'str'
Process finished with exit code 0
目前没有回答
相关问题 更多 >
编程相关推荐