Pi66

pixel-tool
Small Python utilities to debloat windows.
git clone https://git.pi66.xyz/pixel-tool

← back to log

Add files via upload

author: Pixel2175
date: 2024-08-21 11:35
hash: c4dee5d471602d4cf3c735a60959457953c93ee0

Diffstat:

M

ui.py
16 ++++++++++++++++++++++++++++++
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/ui.py b/ui.py
index c396c6e..c54fcb1 100644
--- a/ui.py
+++ b/ui.py
@@ -5,10 +5,24 @@ import webbrowser as web
 import data
 import os
 import requests as req
+import ctypes
+import sys
+
+def is_admin():
+    try:
+        return ctypes.windll.shell32.IsUserAnAdmin()
+    except:
+        return False
+
+if not is_admin():
+    ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
+    sys.exit()
+

 tk.set_appearance_mode('dark')
 tk.set_default_color_theme('theme/purpel.json')

+
 if os.path.exists('log.py'):
     import log
 else:
@@ -16,6 +30,8 @@ else:
         f.write("tweaks=[]")
     import log

+
+
 class Update(tk.CTkToplevel):
     def __init__(self,main):
         super().__init__(main)