thinkhk 发表于 2017-5-4 06:56:26

python是个什么东西---python---py2exe打包后屏蔽控制台

  1.XXX.py
  # coding: UTF-8
  import os
  from pegasusswf.HttpTool import Server
  import time
  import ctypes
  if __name__ == "__main__":
  whnd = ctypes.windll.kernel32.GetConsoleWindow()   
  if whnd != 0:   
  ctypes.windll.user32.ShowWindow(whnd, 0)   
  ctypes.windll.kernel32.CloseHandle(whnd)  
  server = Server()
  server.startServer()
  starttime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) 
  print '%s サービスもうスタートしました...' % starttime
  os.system(r'"./User Guide-excel.exe"')
  2.
  # coding: UTF-8
  # A very simple setup script to create 2 executables.
  #
  # hello.py is a simple "hello, world" type program, which alse allows
  # to explore the environment in which the script runs.
  #
  # test_wx.py is a simple wxPython program, it will be converted into a
  # console-less program.
  #
  # If you don't have wxPython installed, you should comment out the
  #   windows = ["test_wx.py"]
  # line below.
  #
  #
  # Run the build process by entering 'setup.py py2exe' or
  # 'python setup.py py2exe' in a console prompt.
  #
  # If everything works well, you should find a subdirectory named 'dist'
  # containing some files, among them hello.exe and test_wx.exe.
  from distutils.core import setup
  import py2exe
  import sip  #程序打包需要
  import decimal #程序打包需要
  setup(
  # The first three parameters are not required, if at least a
  # 'version' is given, then a versioninfo resource is built from
  # them and added to the executables.
  version = "0.5.0",
  description = "py2exe sample script",
  name = "py2exe samples",
  # targets to build
  #    windows=[{"script" : "exeControl.py"}],
  console = ["exeControl.py"]   #<----------------就是这个地方,上边的windows=是放置GUI的界面出现控制台
  )
页: [1]
查看完整版本: python是个什么东西---python---py2exe打包后屏蔽控制台