萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> python在windows下創建隱藏窗口子進程的方法

python在windows下創建隱藏窗口子進程的方法

   本文實例講述了python在windows下創建隱藏窗口子進程的方法。分享給大家供大家參考。具體實現方法如下:

  ?

1 2 3 4 5 6 7 8 9 10 11 12 13 import subprocess IS_WIN32 = 'win32' in str(sys.platform).lower() def subprocess_call(*args, **kwargs): #also works for Popen. #It creates a new *hidden* window, #so it will work in frozen apps (.exe). if IS_WIN32: startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = subprocess.SW_HIDE kwargs['startupinfo'] = startupinfo retcode = subprocess.call(*args, **kwargs) return retcode

  希望本文所述對大家的Python程序設計有所幫助。

copyright © 萬盛學電腦網 all rights reserved