I was wondering if it is possible to have a python exe made with cx_Freeze open in cmd full screen by default?
Thanks for any help.
If you are prepared to call some Windows API functions then you can make your console go full screen as follows:
STD_OUTPUT_HANDLEto get a handle the console handle.
SetConsoleDisplayModepassing that console handle and
At this point your console window will be displaying full screen.
I don't know if those functions are readily available in one of the win32 Python modules but they are pretty trivial to invoke using ctypes.
There is no integrated cx_Freeze command to do this, however if you run on Windows, the Ctypes provides a way to do this using the WinAPI.
import ctypes kernel32 = ctypes.WinDLL('kernel32') user32 = ctypes.WinDLL('user32') SW_MAXIMIZE = 3 hWnd = kernel32.GetConsoleWindow() user32.ShowWindow(hWnd, SW_MAXIMIZE)
Retrieves the window handle used by the console associated with the calling process.
Basically it gets the handle to the terminal so that
ShowWindow() knows what to modify.
Sets the specified window's show state.
I.e. it tells the window what it should look like.
We pass our terminal handle (stored in
hWnd) to this function and call
3 to maximise.
nCmdShow section for all options