====== Python Tkinter ======
===== Library 사용 =====
import Tkinter
또는
from Tkinter import *
===== Simple Sample =====
import Tkinter
root = Tk()
w = Label(root, text='Hello World')
w.pack()
root.mainloop()
===== 푸시 단추 출력하기 =====
import Tkinter
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.w = Button(frame, text="Hello", command=self.say_hi
self.w.pack()
def say_hi(self):
print "hi there, everyone!"
root = Tk()
app = App(root)
root.mainloop()
{{tag>Python}}