GUI
python supports a lot third party libraries:
- Tk
- wxWidgets
- Qt
- GTK
builtin Tkinter
example
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.helloLabel = Label(self, text='Hello, world!')
self.helloLabel.pack()
self.quitButton = Button(self, text='Quit', command=self.quit)
self.quitButton.pack()
if __name__ == "__main__":
app = Application()
app.master.title("Hello World")
app.mainloop()
小结
Python内置的Tkinter可以满足基本的GUI程序的要求,如果是非常复杂的GUI程序,建议用操作系统原生支持的语言和库来编写。