Tkinter 란?

파이썬으로 데스크톱 UI를 표현할 수 있다.

느낌

계산기 형태 예제가 많은 곳에 올라와있다.

MacOS에서도 잘 실행된다.

프로파일설정등 없이 바로 실행되니 신기하다.

쓰기 편하고 재미있는것 같다.

문서

https://docs.python.org/ko/3/library/tkinter.html

Hello World

import tkinter as tk

class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.create_widgets()

    def create_widgets(self):
        self.hi_there = tk.Button(self)
        self.hi_there["text"] = "Hello World\n(click me)"
        self.hi_there["command"] = self.say_hi
        self.hi_there.pack(side="top")

        self.quit = tk.Button(self, text="QUIT", fg="red",
                              command=self.master.destroy)
        self.quit.pack(side="bottom")

    def say_hi(self):
        print("hi there, everyone!")

root = tk.Tk()
app = Application(master=root)
app.mainloop()