Skip to content

Instantly share code, notes, and snippets.

@mujeebishaque
Created October 19, 2021 21:39
Show Gist options
  • Save mujeebishaque/9f8ddaf8cff72b1bc9a21a2a788f4d4e to your computer and use it in GitHub Desktop.
Save mujeebishaque/9f8ddaf8cff72b1bc9a21a2a788f4d4e to your computer and use it in GitHub Desktop.
alerts.py
from tkinter import messagebox
from tkinter import Tk
class Alerts:
@staticmethod
def show_alert(type=None, text=None):
window = Tk()
window.withdraw()
if type.lower() == 'warning':
return messagebox.showwarning('Warning', text)
if type.lower() == 'error':
return messagebox.showerror('Error', text)
return messagebox.showinfo('Info', text)
@staticmethod
def ask_question(text: str = ''):
window = Tk()
window.withdraw()
return messagebox.askyesno('Info Required', text)
if __name__ == '__main__':
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment