单选题
有如下程序:
import tkinter as tkwindow = tk.Tk()window.geometry('300x150')window.title('my first window')var = tk.StringVar() label = tk.Label(window, textvariable=var)label.pack()on_hit = Falsedef hit_me(): global on_hit if on_hit == False: var.set('You hit me') on_hit = True else: var.set('') on_hit = Falsebutton = tk.Button(window, text='hit me', width=15, height=1, command=hit_me)button.pack()window.mainloop()
下列说法不正确的是?()
A.
程序运行时,窗体上有1个Label和1个Button
B.
Button文字内容在'hit me'和'You hit me'间切换
C.
hit_me函数是按钮事件
D.
window.mainloop()省略不影响运行效果
发表评论 取消回复