iTranslated by AI
App for Retaining Administrator Privileges
I'm taisan11, and I've been hooked on Python lately.
This time, I've created an app that saves administrator privileges for students who are struggling with admin rights!!
I'll explain how it works and give a brief overview of how to use it.
Usage

The GUI is simple and easy to use, so honestly, there's not much to explain.
...Wait, actually there is.
First, when granting administrator privileges, click the "Upgrade Administrator" button, and the familiar popup will appear.
Please do this every time you start the app. Once you close it, the administrator privileges will be discarded...
Next, select the app you want to run. It also includes a file selector.
Finally, press the part that says "run!!" to launch it.
Other characteristic features include being able to change the title and icon from the settings screen. Try using this to trick your parents.
Also, since having it stay in the taskbar all the time might be annoying, there is a feature to minimize it to the system tray (the area in the bottom right). When you want to restore it, just right-click the icon and press "Open". (I got a bit lazy with the icon.)
Mechanism
I think this can also be used when creating regular Python apps.
GUI Implementation
Since it had been a while since I used Python, I thought about using PySimpleGUI, but it seemed like I had to register for it now, so I used the compatible TkEasyGUI instead.
Granting administrator privileges
I used a module(?) called ctypes. It's code that essentially restarts the app with administrator privileges.
ctypes.windll.shell32.ShellExecuteW(
None, "runas", sys.executable, " ".join(sys.argv), None, 1
)
Using the system tray
The system tray is implemented using pystray.
Execution
In this case, I've set it up to run as a subprocess.
There might be compatibility issues with some apps.
Conclusion
Next time, I'm thinking of making an app that bypasses administrator privileges.
Discussion