Python Shell window

J

Jay

Is their any way of setting wear the Python Shell window appears on the
screen when I run my program?

I am testing a full screen program with no Window Frame on a comp with
2 monitors and I have to keep pressing the <Window> Key to bring the
Shell to the front and then moving it manually to the other screen
every time I restart the program.

I would like it to just appear on the other screen from the start.

Any ideas
 
J

jay graves

Jay said:
Is their any way of setting wear the Python Shell window appears on the
screen when I run my program?

I am testing a full screen program with no Window Frame on a comp with
2 monitors and I have to keep pressing the <Window> Key to bring the
Shell to the front and then moving it manually to the other screen
every time I restart the program.

I would like it to just appear on the other screen from the start.

Any ideas

1. Do you really want the CMD prompt to show up? If not, rename your
file from .py to .pyw and it will be hidden. You'll miss all of the
STD* streams though.

2. Find the window and move it to the right place. Here is a script I
use to launch PuTTY (which has the unfortunate problem of 'hiding' its
title bar below my 'Start' bar which I keep at the top of my screen).
It's convient for me to launch PuTTY from this script but I don't see
any reason why you couldn't add this code to your main function and
find the errand CMD prompt and move it.

(For this you need the win32 extension installed)
------------------------------------------------
import win32gui,os,sys,time

command = r"start putty -load %s"

def moveWindow(hwnd, ignored):
x = win32gui.GetWindowText(hwnd)
if x.find('PuTTY') >= 0:
left,top,right,bottom = win32gui.GetWindowRect(hwnd)
if top < 30:
width = right - left
height = bottom - top
win32gui.MoveWindow(hwnd,left,top+30,width,height,1)

try:
p1 = sys.argv[1]
except IndexError:
#print "you must provide a valid machine name"
p1 = "opus"

os.system(command % (p1,))
time.sleep(1.0)
win32gui.EnumWindows(moveWindow, None)
------------------------------------------------


HTH..

Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,292
Messages
2,571,494
Members
48,178
Latest member
SusanaHam4

Latest Threads

Top