そのため、if 条件を使用して 1 つの python ファイルを実装しようとしています。条件に基づいて、アラート メッセージ プロンプトが必要です。2 番目の python ファイルについては、tkinter のものを分けておきたいので、大規模なプロジェクトでよりクリーンになりました。
私はこれを機能させましたが、今では 2 つの警告メッセージが表示されています。if 条件に基づいてポップアップする警告メッセージを 1 つだけにしたい。
#example1.py
import tkinter as tk
import tkinter.messagebox
alert = tk.Tk()
alert.withdraw()
def alertbox():
alertbox.message_1=tk.messagebox.showwarning(title="Alert", message='Working')
alertbox.message_2=tk.messagebox.showwarning(title="Alert", message='not working')
alertbox()
# -----------
#example2.py
import example1
class Logic:
def results():
a = 100
b = 10
if a > b:
example1.alertbox.message_1
else:
example1.alertbox.message_2