{{{~cpp # 함수 기반 # written by eternalbleu@gmail.com from Tkinter import * def print_console(): print 'WELCOME TO TKINTER PROGRAMMING' root = Tk() frame = Frame(root) frame.pack() m = Label(frame, text = "TKINTER PROGRAMMING") m.pack() q_button = Button(frame, text = "OK", command = frame.quit) q_button.pack(side=LEFT) p_button = Button(frame, text = "PRINT", command = print_console) p_button.pack(side=RIGHT) root.mainloop() }}} {{{~cpp # 클래스 기반 # written by eternalbleu@gmail.com class App: def __init__(self, master): frame = Frame(master) frame.pack() self.q_button = Button(master, text="OK", command = frame.quit) self.q_button.pack(side=LEFT) self.p_button = Button(master, text="PRINT", command = self.print_msg) self.p_button.pack(side=LEFT) def print_msg(): print"HELLO WORLD" root = Tk() app = App(root) root.mainloop() }}}