#!/usr/bin/python
# -*- coding: UTF-8 -*-
##from Tkinter import Label,mainloop
##Label(text="this is a label").pack() #pack() 用几何管理器来认识控件
##mainloop()
from Tkinter import*
class App:
def __init__(self,master):
frame=Frame(master)#构造器通过创建一个Frame帧窗口部件,并且把它存储在一个frame的变量中
frame.pack()
self.button=Button(frame,text=u"退出",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()