Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 902 Bytes

tkinter.md

File metadata and controls

40 lines (29 loc) · 902 Bytes

Tkinter

Helo World

from os.path import basename, splitext
import tkinter as tk
# from tkinter import ttk


class Application(tk.Tk):
    name = basename(splitext(basename(__file__.capitalize()))[0])
    name = 'Foo'

    def __init__(self):
        super().__init__(className=self.name)
        self.title(self.name)
        self.bind("<Escape>", self.quit)
        self.lbl = tk.Label(self, text="Hello World")
        self.lbl.pack()
        self.btn = tk.Button(self, text='Quit', command=self.quit)
        self.btn.pack()

    def quit(self, event=None):
        super().quit()


app = Application()
app.mainloop()