I have a script where normally I would not want the console window displayed like a .py file does and using the .pyw extension does that just as it's designed to do.
My question, is there a way to bring the running script's console window up from a .pyw file?
Ended up going with the method of using a .py file and suppressing the console window.
Bound a simple toggle function to a button:
import ctypes
def raise_console(console_toggle):
"""Brings up the Console Window."""
if console_toggle:
# Show console
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 4)
else:
# Hide console
ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
console_toggle = not console_toggle
console_toggle = False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With