diff --git a/votm/manage.py b/votm/manage.py index 848138e..66cad80 100644 --- a/votm/manage.py +++ b/votm/manage.py @@ -22,6 +22,7 @@ import win32api import xlsxwriter import win32event +import ctypes from shutil import copyfile from os import path, remove from datetime import date @@ -81,6 +82,17 @@ def __init__(self): ] ] ) + if not ctypes.windll.shell32.IsUserAnAdmin(): + self.withdraw() + self.attributes("-topmost", 1) + self.title("Error") + mg.showwarning( + "Error", + "This App requires Administrator Privileges to function properly.\nPlease Retry with Run As Administrator.", + parent=self, + ) + self.destroy() + sys.exit(0) self.iconbitmap(Root.DATAFILE[0]) @classmethod diff --git a/votm/vote.py b/votm/vote.py index 69b02d8..5f49c22 100644 --- a/votm/vote.py +++ b/votm/vote.py @@ -21,6 +21,7 @@ import win32api import win32event +import ctypes from os import path from datetime import date import tkinter as tk @@ -49,6 +50,17 @@ def __init__(self): self.attributes("-alpha", 0.0) self.protocol("WM_DELETE_WINDOW", Win.s_cls) self.ins_dat([ASSETS_PATH.joinpath(i) for i in ["v_r.ico", "bg.png"]]) + if not ctypes.windll.shell32.IsUserAnAdmin(): + self.withdraw() + self.attributes("-topmost", 1) + self.title("Error") + mg.showwarning( + "Error", + "This App requires Administrator Privileges to function properly.\nPlease Retry with Run As Administrator.", + parent=self, + ) + self.destroy() + sys.exit(0) self.iconbitmap(default=Root.DATAFILE[0]) @classmethod