mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 10:37:23 +00:00
Hide console on Windows after start
This commit is contained in:
commit
6022f48040
20
cps.py
20
cps.py
@ -27,7 +27,27 @@ sys.path.insert(0, path)
|
|||||||
|
|
||||||
from cps.main import main
|
from cps.main import main
|
||||||
|
|
||||||
|
|
||||||
|
def hide_console_windows():
|
||||||
|
import ctypes
|
||||||
|
import os
|
||||||
|
|
||||||
|
hwnd = ctypes.windll.kernel32.GetConsoleWindow()
|
||||||
|
if hwnd != 0:
|
||||||
|
try:
|
||||||
|
import win32process
|
||||||
|
except ImportError:
|
||||||
|
print("To hide console window install 'pywin32' using 'pip install pywin32'")
|
||||||
|
return
|
||||||
|
ctypes.windll.user32.ShowWindow(hwnd, 0)
|
||||||
|
ctypes.windll.kernel32.CloseHandle(hwnd)
|
||||||
|
_, pid = win32process.GetWindowThreadProcessId(hwnd)
|
||||||
|
os.system('taskkill /PID ' + str(pid) + ' /f')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
if os.name == "nt":
|
||||||
|
hide_console_windows()
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,3 +43,6 @@ comicapi>=2.2.0,<3.3.0
|
|||||||
|
|
||||||
# Kobo integration
|
# Kobo integration
|
||||||
jsonschema>=3.2.0,<4.23.0
|
jsonschema>=3.2.0,<4.23.0
|
||||||
|
|
||||||
|
# Hide console Window on Windows
|
||||||
|
pywin32>=220,<310
|
||||||
|
Loading…
Reference in New Issue
Block a user