Python 2.7列表框插入类型

Python 2.7列表框插入类型,python,tkinter,Python,Tkinter,我可以在Tkinter中listbox的第二个参数中使用类型“int”吗?我在任何文档中都找不到它 x = int(584) listBox.insert(0, x) 您的代码是正确的,但请尝试以下操作: from Tkinter import * screen = Tk() listBox = Listbox(screen) listBox.pack() x = int(584) listBox.insert(0, x) mainloop() 你试过了吗?有错误吗?你的问题是什么

我可以在Tkinter中listbox的第二个参数中使用类型“int”吗?我在任何文档中都找不到它

x = int(584)
listBox.insert(0, x)

您的代码是正确的,但请尝试以下操作:

from Tkinter import *

screen = Tk()

listBox = Listbox(screen)
listBox.pack()

x = int(584)

listBox.insert(0, x)

mainloop()

你试过了吗?有错误吗?你的问题是什么?是的,有时会发生奇怪的错误。但我不知道这是否是原因。欢迎来到堆栈溢出。我在帖子中对英语进行了调整。你用它试过了吗?你得到了什么错误?TclError:bad option“setinteger但得到了“0.0”@Tkinter:你发布的代码不可能给出那个错误。