AndrewTaylor
AndrewTaylor

Reputation: 11

Change the window size for "py.exe"

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

Upvotes: 0

Views: 691

Answers (1)

AndrewTaylor
AndrewTaylor

Reputation: 11

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

Upvotes: 1

Related Questions