/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tkinter_examples/class_Example_with_Frame_Text.py
36 строк
763 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" import tkinter as tk class Example(tk.Frame): def __init__(self, parent): super().__init__(parent) self.parent = parent self.init_ui() def init_ui(self): self.text = tk.Text(self, width=20, height=10) self.text.pack() self.text.insert(1.0, "Hello World!\nFoo\nBar\n\n123\n") self.button = tk.Button(self, text="Append", command=self.on_append) self.button.pack() self.pack() def on_append(self): self.text.insert(tk.END, "Go-go-go!\n") if __name__ == "__main__": root = tk.Tk() root.title("Example") ex = Example(root) root.geometry("300x250+300+300") root.mainloop()