0

I am reading and writing files to the 'py.exe' screen. I have a *.py script that I double click which pops up the 'py.exe' window, where I operate within.

Its all fine, but the default window dimensions are a bit landscape-y and I want to save having to "windows+leftcursor" all the time.

I want to change the default dimensions of the py.exe window to what I want them to be.

import easygui

filenames=easygui.fileopenbox('Welcome',default='c:\data\*.ers',multiple=True)

for filename in filenames:
    with open(filename) as f:
               print("\n\n" + filename + "\n\n", f)

py.exe window that I want to change its default dimensions

3
  • I do not understand the problem. Could you give us more information? Commented Jan 11, 2019 at 7:20
  • Show screenshot of your window
    – Alderven
    Commented Jan 11, 2019 at 10:47
  • On Windows you would be better using the properties entry on the console window's system menu to modify the shortcut used to launch py.exe (possibly creating a copy of the shortcut initially).
    – Richard
    Commented Jan 16, 2019 at 7:53

1 Answer 1

1
import os
os.system("mode con cols=100 lines=300")

ever better now I use win32gui to locate the window in a certain position and size

import win32gui
hwnd = win32gui.GetForegroundWindow()
win32gui.MoveWindow(hwnd, 100, 0, 1100, 1000, True)

you need to install pywin32 first

pip install pywin32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.