Wednesday, April 28, 2010

python gui编程

Tkinter很不错的说,很轻便,一些常用的windows命令都可以用这个来搞定了。
 
一个例子如下:
# File: hello2.py    from Tkinter import *    class App:        def __init__(self, master):            frame = Frame(master)          frame.pack()            self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)          self.button.pack(side=LEFT)            self.hi_there = Button(frame, text="Hello", command=self.say_hi)          self.hi_there.pack(side=LEFT)        def say_hi(self):          print "hi there, everyone!"    root = Tk()    app = App(root)    root.mainloop()  
 
 
2010-04-28

sunjingwei

No comments: