显示下拉菜单中的选项

时间:2014-07-31 10:31:48

标签: python tkinter

当我打印" chunk" ,输出将显示我" PY_VAR0"我哪里出错?

chunk = IntVar(root)
chunk.set("4") # default value to show on the GUI
print chunk

#option for segment size
chunkOption = OptionMenu(root, chunk,"4", "16", "32", "64", "128", "265", "512" )
chunkOption.pack(side=Tkinter.TOP)

1 个答案:

答案 0 :(得分:0)

要使用IntVar中的值,您必须使用get方法获取值:

print chunk.get()