2

I've been programming with Python and have made an EXE file. I've added a shortcut to it in the startup folder in order to make it autostart with Windows.

The problem is that it takes some time between when the blank black console appears and the actual run of the program (i.e. it takes time until the program actually starts working).

How do I get rid of the blank black console window? I think it happens because Windows takes time to load the file's folders and libraries.

I want that the black window to be hidden at startup using win32gui.ShowWindow(win, 0), but it takes too long for this to happen. It works fine when launched normally but not when run from the startup directory while Windows is starting.

Eryk Sun
  • 33,190
  • 5
  • 92
  • 111
Ben L
  • 743
  • 2
  • 7
  • 15
  • How did you create the exe file? – Mikko Ohtamaa Nov 24 '15 at 17:31
  • from distutils.core import setup import py2exe setup(console=['location']) and used py2exe – Ben L Nov 24 '15 at 17:40
  • Cool. Thanks ! Ps. you should be able to edit the question to add more information there. – Mikko Ohtamaa Nov 24 '15 at 17:42
  • 1
    See this http://stackoverflow.com/questions/3275293/hiding-console-window-of-python-gui-app-with-py2exe – Mikko Ohtamaa Nov 24 '15 at 17:43
  • Please take care to make your title and your question match each other -- it looks like the actual question isn't about startup delay at all, but is about hiding the window. – Charles Duffy Nov 24 '15 at 18:02
  • hiding is not the problem. it hides just fine, the delay is the problem. the program makes what it should do, but in a delay of a 10 secs, in which it shows the cmd window – Ben L Nov 24 '15 at 18:51
  • @BenL, it's a console window. There's no such thing as a "cmd" window. cmd.exe and python.exe, and apparently your EXE, are console applications that either inherit or cause Windows to autostart an instance of conhost.exe, which hosts the console window. Any Windows application can attach to one, and only one, console window. But "console" applications are flagged to do this automatically instead of having to manually call `AttachConsole` or `AllocConsole`. – Eryk Sun Nov 25 '15 at 14:52
  • Thank you. I'm quite a beginner so excuse me for using the wrong terms. I understand alittle better now, thanks. However, you haven't really solved the problem. there's a delay between the time the console window appears and the time the file actually starts working – Ben L Nov 25 '15 at 19:36

0 Answers0