Created
October 19, 2021 21:39
-
-
Save mujeebishaque/9f8ddaf8cff72b1bc9a21a2a788f4d4e to your computer and use it in GitHub Desktop.
alerts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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