Skip to content

Instantly share code, notes, and snippets.

@Ronkiro
Created May 20, 2019 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ronkiro/4a36b5daa1e3f355dcf62f21d28b5e7f to your computer and use it in GitHub Desktop.
Save Ronkiro/4a36b5daa1e3f355dcf62f21d28b5e7f to your computer and use it in GitHub Desktop.
import ctypes
kernel32 = ctypes.WinDLL('kernel32')
user32 = ctypes.WinDLL('user32')
SW_HIDE = 0
hWnd = kernel32.GetConsoleWindow()
if hWnd:
user32.ShowWindow(hWnd, SW_HIDE)
#STD
def closeEvent(self, event):
try:
user32.ShowWindow(hWnd, 1)
except:
pass
# Vê necessidade de iniciar com console ou sem.
import ctypes
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-C', '--console', action = 'store_true', required = False)
arguments = parser.parse_args()
HIDE_CONSOLE_BOOL = not(arguments.console)
if HIDE_CONSOLE_BOOL:
kernel32 = ctypes.WinDLL('kernel32')
user32 = ctypes.WinDLL('user32')
SW_HIDE = 0
hWnd = kernel32.GetConsoleWindow()
if hWnd:
user32.ShowWindow(hWnd, SW_HIDE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment