单选题

import tkinter as tkwindow = 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 = Falsedef 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!

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部