Improve handling of console window in windowed apps
Suppresses console window flicker for PyInstaller windowed applications by redirecting stdout and stderr in main.py. Updates logging setup to avoid console output in windowed mode and adds fallback error logging. Suppresses pkg_resources deprecation warnings to further reduce unwanted console output.
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Suppress console window for windowed applications (PyInstaller --windowed)
|
||||
if getattr(sys, 'frozen', False):
|
||||
# Running as compiled executable
|
||||
if sys.stdout is None or sys.stderr is None:
|
||||
# Windowed mode - redirect stdout/stderr to prevent console window flicker
|
||||
import io
|
||||
sys.stdout = io.StringIO()
|
||||
sys.stderr = io.StringIO()
|
||||
|
||||
from PySide6.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
|
||||
Reference in New Issue
Block a user