Python是一种非常好的动态脚本语言,无需编译,立即执行。
下面是我写的一个界面程序,用到了Tkinter库。
from Tkinter import * def on_cleck1(): label1['text'] = text1.get() def on_cleck2(): label2['text'] = text2.get() root = Tk(className = 'ldg') label1 = Label(root) label2 = Label(root) label1['text'] = 'text1' label2['text'] = 'text2' label1.pack() label2.pack() text1 = StringVar() text1.set('Input First Name') text2 = StringVar() text2.set('Output Last Name') entry1 = Entry(root) entry1['text'] = text1 entry1.pack() entry2 = Entry(root) entry2['text'] = text2 entry2.pack() button1 = Button(root) button2 = Button(root) button1['text'] = 'change First Name' button2['text'] = 'change Last Name' button1['command'] = on_cleck1 button2['command'] = on_cleck2 button1.pack() button2.pack() root.mainloop()