我希望下面的代码片段从组合框中获取用户选择,并将其显示在我设置的列表框中。当我运行代码并从组合框中选择时,所选内容在列表框中显示为<tkinter.StringVar object at 0x1007ae748>
,而不是实际的文本。你知道吗
以下是代码段:
self.datesel = StringVar()
self.entry_date = ttk.Combobox(self.frame_crearorden,width = 24, textvariable = self.datesel)
self.entry_date.config(values = datescroll_list)
self.dateusersel = self.entry_date.get()
global getvalue
getvalue = self.datesel
print(getvalue)
这是我用来在列表框上显示用户选择的函数(通过创建包含所有要显示信息的字典):
def orderZoom(self):
nombre = contents1
nicenum = orderResult
email = contents2
num = contents3
fechacreacion1 = fechaDeCreacion
fechaentrega = getvalue
global ordenOrganiz
ordenOrganiz = {"Num Orden": nicenum,
"Nombre": nombre,
"Email": email,
"Num Tel/Cel": num,
"Orden Creada:": fechacreacion1,
"Fecha de Entrega": fechaentrega}
return dict(ordenOrganiz)
问题是在用户有机会从菜单中选择某个内容之前调用
get
方法。在用户能够选择某些内容之后,您需要从orderZoom
内部获取值。你知道吗相关问题 更多 >
编程相关推荐