GUI: Another attempt to hide the console window

This commit is contained in:
deajan 2025-06-13 13:18:50 +02:00
parent 0e550d6f51
commit a3b3573802
2 changed files with 7 additions and 2 deletions

View file

@ -287,7 +287,7 @@ def compile(
NUITKA_OPTIONS += " --plugin-enable=tk-inter"
# So for an unknown reason, some windows builds will not hide the console, see #146
# We replaced this option with a python version in gui\__main__.py
# NUITKA_OPTIONS += " --windows-console-mode=hide"
NUITKA_OPTIONS += " --windows-console-mode=hide"
else:
NUITKA_OPTIONS += " --plugin-disable=tk-inter --nofollow-import-to=FreeSimpleGUI --nofollow-import-to=_tkinter --nofollow-import-to=npbackup.gui"
if onefile:

View file

@ -16,6 +16,10 @@ from logging import getLogger
logger = getLogger()
import win32gui
import win32process
import psutil
def handle_current_window(action: str = "minimize") -> None:
"""
@ -37,8 +41,9 @@ def handle_current_window(action: str = "minimize") -> None:
logger.debug(
"No hwndmain found for current executable, trying foreground window"
)
# This will hide the console and the main gui
# pylint: disable=I1101 (c-extension-no-member)
hwndMain = win32gui.GetForegroundWindow()
# hwndMain = win32gui.GetForegroundWindow()
if hwndMain:
if action == "minimize":
# pylint: disable=I1101 (c-extension-no-member)