So I’m trying to implement one python file with if-conditions, and based on the condition I want to have an alert message prompt. For the 2nd python file, I wanted to keep the tkinter stuff separate so it’s cleaner for larger scale projects.
I got this to work but now I have 2 alert messages populating. I only want 1 alert message to pop up based on if condition.
#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