meta data for this page
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
python:tkinter [2013/09/20 18:02] moonrepeat |
python:tkinter [2021/03/10 21:42] (현재) |
||
---|---|---|---|
줄 1: | 줄 1: | ||
- | ====== Tkinter ====== | + | ====== Python Tkinter ====== |
===== Library 사용 ===== | ===== Library 사용 ===== | ||
<code>import Tkinter</code> | <code>import Tkinter</code> | ||
줄 16: | 줄 16: | ||
root.mainloop() | root.mainloop() | ||
</code> | </code> | ||
+ | ===== 푸시 단추 출력하기 ===== | ||
+ | <code> | ||
+ | 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() | ||
+ | |||
+ | </code> | ||
+ | |||
+ | {{tag>Python}} |