标签:style blog http io os ar sp 2014 on
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
一个简单的tkinter示例
import Tkinter as tk class Application(tk.Frame): # 必须要从Frame继承,frame是一个安排control布局的容器 def __init__(self, master = None): tk.Frame.__init__(self, master) # 调用parent的构造函数 self.grid()# self.createWidgets() def createWidgets(self): self.quitButton = tk.Button(self, text = 'quit', command = self.quit) # button作为frame的child来构造 self.quitButton.grid()# 将button以grid的样式添加到Frame中 app = Application() app.master.title("sample application") app.mainloop() #启动循环,等待鼠标和键盘的输入
之前用过MFC QT IOS,所有的这些关于GUI开发的库都有通用的规则,无非是Control的建立,Control事件的相应,Control的布局,事件循环,从上面四个角度来理解,tkinter半天就能掌握好。
标签:style blog http io os ar sp 2014 on
原文地址:http://blog.csdn.net/wangeen/article/details/39557569