From a3b35738024cf71bfbb9456714c33f7ab71ae37a Mon Sep 17 00:00:00 2001 From: deajan Date: Fri, 13 Jun 2025 13:18:50 +0200 Subject: [PATCH] GUI: Another attempt to hide the console window --- bin/compile.py | 2 +- npbackup/gui/handle_window.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/compile.py b/bin/compile.py index 786e762..8d8a805 100644 --- a/bin/compile.py +++ b/bin/compile.py @@ -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: diff --git a/npbackup/gui/handle_window.py b/npbackup/gui/handle_window.py index 674adfd..6f038c9 100644 --- a/npbackup/gui/handle_window.py +++ b/npbackup/gui/handle_window.py @@ -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)