PythonWin

Larry Bates lbates at syscononline.com
Mon Mar 14 16:41:22 EST 2005


tkpmep at hotmail.com wrote:
> I have a Python program that collects user input using
> 
> msg = "Enter the full path and name of the file to be processed: "
> answer = raw_input(msg)
> 
> If I run it in IDLE, the question is splashed across the execution
> window, and if it is long, simply wraps to the next line. Most
> importantly, it is intelligible, because I see the entire message. I
> enter my answer on the next line, and once again, I can see the entire
> path and file name, even if it is longer than long.
> 
> However, if I run it in ActivePython's PythonWin, a small message box
> pops up, with hardly any space to diplay msg and a smallish space into
> which I can type my answer. How can I force PythonWin to get its input
> from the execution window or to enlarge its message box sufficiently to
> display the entire question?
> 
> Thomas Philips
> 
Take a look at the following sample program.  It will allow you to
browse to the file that you want to open.

import win32ui
import sys
f=win32ui.CreateFileDialog(1, None, "*.txt", 0, 'Text Files|||')
x=f.SetOFNInitialDir("C:\\")
f.SetOFNTitle("Open Text File")
result=f.DoModal()
if result == win32con.IDCANCEL: sys.exit()
print "path selected=", f.GetPathName()
print "Filename selected=", f.GetFileName()


Hope it helps.

-Larry Bates



More information about the Python-list mailing list