/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tkinter_examples/hello_world.py
37 строк
782 B
gil9red
Refactoring. Using black code style
28 июн 2023, 13:13
28 июн 2023, 13:13
a351f0c
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" # https://docs.python.org/3/library/tkinter.html import tkinter as tk class Application(tk.Frame): def __init__(self, parent=None): super().__init__(parent) self.init_ui() def init_ui(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=root.destroy) self.QUIT.pack(side="bottom") self.pack() def say_hi(self): print("hi there, everyone!") if __name__ == "__main__": root = tk.Tk() app = Application(parent=root) app.mainloop()