Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old April 10th, 2006, 07:45 PM
Jay
Guest
 
Posts: n/a
Default Python Shell window

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

  #2  
Old April 10th, 2006, 10:15 PM
jay graves
Guest
 
Posts: n/a
Default Re: Python Shell window

Jay wrote:[color=blue]
> 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[/color]

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

  #3  
Old April 10th, 2006, 10:15 PM
jay graves
Guest
 
Posts: n/a
Default Re: Python Shell window

> find the errand CMD prompt and move it.

errand -> errant

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles