python simple example

from Tkinter import *

def on_click():
        label['text'] = text.get()

root = Tk(className='bitunion')
label = Label(root)
label['text'] = 'be on your own'
label.pack()

text = StringVar()
text.set('hello')

entry = Entry()
entry['textvariable'] = text
entry.pack()

button = Button(root)
button['text'] = 'hello my button'
button['command'] = on_click
button.pack()

root.mainloop()
参考:http://kb.cnblogs.com/page/75245/

你可能感兴趣的:(python simple example)