Answers for "run python without terminal"

0

run python without terminal

import ctypes
import os
import win32process

hwnd = ctypes.windll.kernel32.GetConsoleWindow()      
if hwnd != 0:      
    ctypes.windll.user32.ShowWindow(hwnd, 0)      
    ctypes.windll.kernel32.CloseHandle(hwnd)
    _, pid = win32process.GetWindowThreadProcessId(hwnd)
    os.system('taskkill /PID ' + str(pid) + ' /f')
    
#this code will close the console window as soon as the code is run
Posted by: Guest on April-01-2021

Code answers related to "run python without terminal"

Python Answers by Framework

Browse Popular Code Answers by Language