468,537 Members | 1,926 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

Python Shell window

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

Apr 10 '06 #1
2 1996
Jay wrote:
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

Apr 10 '06 #2
> find the errand CMD prompt and move it.

errand -> errant

Apr 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Logan | last post: by
9 posts views Thread by Peter Wu | last post: by
4 posts views Thread by Chang LI | last post: by
30 posts views Thread by bblais | last post: by
8 posts views Thread by Dave Potts | last post: by
16 posts views Thread by John Salerno | last post: by
4 posts views Thread by emin.shopper | last post: by
15 posts views Thread by lixinyi.23 | last post: by
8 posts views Thread by james.kirin39 | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.