When launching a script-type python file from Windows you get a windows shell type window where the script runs. How can the script determine and also set/control the Window Size, Screen Buffer Size and Window Position of said window?. I suspect this can be done with the pywin32 module but I can’t find how.
When launching a script-type python file from Windows you get a windows shell type
Share
You can do this using the SetConsoleWindowInfo function from the win32 API. The following should work:
UPDATE:
The window position is basically what the
rectvariable above sets through theleft, top, right, bottomarguments. The actual size is derived from these arguments:To set the screen buffer size to, say, 100 rows by 80 columns, you can use the SetConsoleScreenBufferSize API: