Reputation: 5
I compile my Python tkinter code, when I run *.exe twice, there are two main tkinter windows (same as when I run windows notepad.exe twice).
But I want to prevent tkinter .exe from being able to start twice. What can I do so that tkinter can only be started once? Whether or not I click tkinter.exe on the windows desktop dozens of times.
Upvotes: 0
Views: 525
Reputation: 162
Requirements
pip install wmi
Suggested Solution
if "tkinkter.exe" in [ x.Name for x in wmi.WMI().Win32_Process() ]:
exit()
Upvotes: 1