运行如上代码,对按钮点击二次后,在文本框中显示的文字为?( )

nj618825 单选题 共 个子题
import tkinter as tk
window = tk.Tk()
window.title('Mywindow')
window.geometry('200x100')
var = tk.StringVar()
p= tk.Label(window,textvariable=var,bg='green',font=('Arial', 12),width=15, height=2)
p.pack()
on_hit = False
def hit_me():
    global on_hit
    if on_hit == False:
        on_hit = True
        var.set('You hit me!')
    else:
        on_hit = False
        var.set('I Love Python!')
b=tk.Button(window, text='点我', width=15, height=2,command=hit_me)
b.pack()
window.mainloop()
A

You hit me!

B

I Love Python!

C

You hit me! I Love Python!

D

I Love Python! You hit me!

正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧