【发布时间】:2017-06-09 22:11:05
【问题描述】:
我在 python 2.7 上使用 tkinter。我的问题是我没有成功将变量输入entry_number;该函数被调用,但它没有打印任何内容。
我如何知道复选框是否被选中?
from tkinter import *
from tkinter import Tk, StringVar, Label, Entry, Button
def call():
print (e)
root = Tk()
var1 = IntVar()
c=Checkbutton(root, text="Bou ", variable=var1).grid(row=4, column=1)
text = StringVar(root)
button = Button(root, text='call',
command=call)
entry_number = Entry(root)
button.grid(column=8, row=20)
entry_number.grid(column=6,row=4)
e = entry_number.get()
root.mainloop()
【问题讨论】:
-
from tkinter import *from tkinter import Tk, StringVar, Label, Entry, Button不知道为什么要导入两次
标签: python python-2.7 tkinter