mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-11 04:42:23 +03:00
Allow one copy of the app at a time
This commit is contained in:
parent
7bfa188e90
commit
27c00f1a90
@ -598,6 +598,16 @@ class AppWindow:
|
|||||||
|
|
||||||
# Run the app
|
# Run the app
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
# Ensure only one copy of the app is running. OSX does this automatically. Linux TODO.
|
||||||
|
if platform == 'win32':
|
||||||
|
import ctypes
|
||||||
|
h = ctypes.windll.user32.FindWindowW(u'TkTopLevel', unicode(applongname))
|
||||||
|
if h:
|
||||||
|
ctypes.windll.user32.ShowWindow(h, 9) # SW_RESTORE
|
||||||
|
ctypes.windll.user32.SetForegroundWindow(h) # Probably not necessary
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
app = AppWindow(root)
|
app = AppWindow(root)
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user