Maximize main window with code

2006-06-30 Thread JohnJohnUSA
I am new to Python.  How do I get the following program to appear
initially with the window maximized?  Thanks for your help!

from Tkinter import *
# set up the window itself
top = Tk()
F = Frame(top)
F.pack()
# add the widgets
lHello = Label(F, text="Hello")
lHello.pack()
bQuit = Button(F, text="Quit", command=F.quit)
bQuit.pack()
# set the loop running
top.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Error Trapping

2006-07-01 Thread JohnJohnUSA
I ran the following program to retrieve entries from the windows
registry on Windows XP:


import win32api, win32con
aReg = win32api.RegConnectRegistry(None,
win32con.HKEY_CURRENT_USER)
aKey = win32api.RegOpenKeyEx(aReg,
r"Software\Microsoft\Internet Explorer\PageSetup")
for i in range(100):
Name, Data, Type = win32api.RegEnumValue(aKey, i)
print "Index=(", i,") Name=[",
Name,"] Data=[",Data,"]
Type=[",Type,"]"
win32api.RegCloseKey(aKey)

This is the program output:

[code:1:8bb6fccb25]Index=( 0 ) Name=[ header ]
Data=[ &w&bPage &p of &P ] Type=[ 1
]
Index=( 1 ) Name=[ footer ] Data=[
&u&b&d ] Type=[ 1 ]
Index=( 2 ) Name=[ margin_bottom ] Data=[ 0.75
] Type=[ 1 ]
Index=( 3 ) Name=[ margin_left ] Data=[ 0.75
] Type=[ 1 ]
Index=( 4 ) Name=[ margin_right ] Data=[ 0.75
] Type=[ 1 ]
Index=( 5 ) Name=[ margin_top ] Data=[ 0.75
] Type=[ 1 ]

Traceback (most recent call last):
  File "F:/temp/Python Test Folder/Read Windows Registry
Entries (No error trapping).py", line 5, in -toplevel-
Name, Data, Type = win32api.RegEnumValue(aKey, i)
error: (259, 'PyRegEnumValue', 'No more data is
available.')[/code:1:8bb6fccb25]

I received an error because I tried to read past the last entry for
this key.  The following is a modified version of the program to trap
any error on key entry retrieval:

[code:1:8bb6fccb25]import win32api, win32con, sys
aReg = win32api.RegConnectRegistry(None,
win32con.HKEY_CURRENT_USER)
aKey = win32api.RegOpenKeyEx(aReg,
r"Software\Microsoft\Internet Explorer\PageSetup")
for i in range(100):
try:
Name, Data, Type = win32api.RegEnumValue(aKey, i)
print "Index=(", i,") Name=[",
Name,"] Data=[",Data,"]
Type=[",Type,"]"
except:
break
win32api.RegCloseKey(aKey)[/code:1:8bb6fccb25]

This is the program output:

[code:1:8bb6fccb25]Index=( 0 ) Name=[ header ]
Data=[ &w&bPage &p of &P ] Type=[ 1
]
Index=( 1 ) Name=[ footer ] Data=[
&u&b&d ] Type=[ 1 ]
Index=( 2 ) Name=[ margin_bottom ] Data=[ 0.75
] Type=[ 1 ]
Index=( 3 ) Name=[ margin_left ] Data=[ 0.75
] Type=[ 1 ]
Index=( 4 ) Name=[ margin_right ] Data=[ 0.75
] Type=[ 1 ]
Index=( 5 ) Name=[ margin_top ] Data=[ 0.75
] Type=[ 1 ][/code:1:8bb6fccb25]

The latter program will trap any error resulting from trying to
retrieve the key values.  What I want to do is to specifically trap
the error denoting that there is no more data available so I can
continue executing more code as oppose to aborting the program.  if
the error is something other than no more data available, then I want
to abort the program with an error message.

What code is needed to specifically trap the "no more data is
available" error?

Thank you in advance for your help!

-- 
http://mail.python.org/mailman/listinfo/python-list


Request for addition to Preferences

2006-07-02 Thread JohnJohnUSA
I wasn't sure how to get my request to the appropriate person so I am
posting it here!

When I log in to this site, I normally want to go to the Python forum.
 I can get there via a series of mouse clicks.  I would prefer to have
the option of specifying in my Preferences where I want to be
positioned within this site upon login.  After setting
"python" in my Preferences, I would automatically be
positioned on the python forum page.  This would save me and others a
lot of work in getting to where I want to be.

The dropdown list that I saw somewhere on this site could be placed in
the Preferences section to enable me to select where I want to go upon
log in and I would be positioned there automatically.

Can this feature be implemented.  I would think that everyone coming
to this site may like it as it would be a good time and work saver. 
One would also have the option of not selecting a specific location
in which case they would be positioned on the main page as everyone
currently is.

Thanks in advance for considering adding this feature to this website!

-- 
http://mail.python.org/mailman/listinfo/python-list


re:Request for addition to Preferences

2006-07-02 Thread JohnJohnUSA
The site that I am referring to is the one that I used to post my
request located at:

http://www.nixforum.org/

-- 
http://mail.python.org/mailman/listinfo/python-list


How to specify default directory for saving files in IDLE

2006-07-03 Thread JohnJohnUSA
I am using Python IDLE 2.4.3 on Windows XP. I use File->New Window
to create a new program. In the Save As dialog, it always takes me to
the python program directory (where python is installed). Since this
is not where I want to save my source file, I have to select the
directory I want.

Is there a way that I can have python always bring up the Save As
dialog pointing to the directory of my choice?  In other words, I
would like to specify what I want the default directory for saving
files to be.

In addition, is there a way to get IDLE to add the extension .py to
the file name in the Save As dialog without my having to type it each
time?

Thank you in advance for your help!

-- 
http://mail.python.org/mailman/listinfo/python-list