Я пытаюсь создать маленький GUI с помощью tkinter. Чтобы сделать мой код более читабельным, я хочу разделить код на 2 файла. Один для информации GUI и один для информации о процессе. Или это плохая идея?
Поэтому я создаю gui .py, куда я импортирую информацию о своем процессе из program.py.
gui .py:
import tkinter as tk
from program import *
root = tk.Tk()
btn_Start = tk.Button(text="Start", command=start_loop)
btn_Stop = tk.Button(text="Stop", command=stop_loop, state=tk.DISABLED)
btn_Start.grid(row=1, column=0)
btn_Stop.grid(row=1, column=1)
root.mainloop()
program.py:
def start_loop():
print('disable Start button and enable Stop button')
# what is the code to disable the start button and enable the stop button?
def stop_loop():
print('disable Stop button and enable Start button')
# what is the code to disable the stop button and enable the start button?
Как сообщить кнопке информацию об отключении / включении в моем файле program.py? Я не понимаю, как я получаю информацию из gui в программу и обратно в gui?
Спасибо за вашу помощь