python GUI - tkinter 01

python GUI - tkinter 01

 

#!/usr/bin/python3

import tkinter as tk

window = tk.Tk()
window.title('yyyyy')
window.geometry("200x100")

var = tk.StringVar()
# l = tk.Label(window, text='OMG! this is TK', bg='green', font=('Arial', 12), width=15, height=2)
l = tk.Label(window, textvariable=var, bg='green', font=('Arial', 12), width=15, height=2)

l.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('')

b = tk.Button(window, text='click me', width=15, height=2, command=hit_me)
b.pack()
window.mainloop()

  

上一篇:关于B+树 (前言)


下一篇:HIT 软件构造 8 :第10,11讲