以前总是感觉时间是虚度的,现在决定记录下自己学习的点点滴滴。最近开始学习python,他的简单,快捷让我很是着迷,从今天起,几下我学习的点滴。
- #!/usr/local/bin/python
- from Tkinter import *
- #典型的面向对象
- class Application(Frame): #python中的继承
- def __init__(self, master=None): #self类似与c++中的this,表示创建的对象
- Frame.__init__(self, master) #调用父类中的初始化方法
- self.grid()
- self.createWidgets()
- def createWidgets(self):
- self.quitButton = Button ( self, text='Quit', command=self.quit )
- self.quitButton.grid()
- app = Application()
- app.master.title("Sample application")
- app.mainloop()