473,545 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

win32ui CreateFileDialo g Can't Set Dir

I get the following error when I run this script to open a file dialog.
I've searched the web and news groups for this issue and have not found any
references. I get the same behavior when I run it from Python or Pythonwin.
I'm new to win32... and would appreciate any help I can get.

If I comment out the following line it works fine but I have to navigate to
my initial directory.....

pd.SetOFNInitia lDir = r'D:\Documents and Settings\John'


# File Dialog Example
import win32ui
import win32con
pd = win32ui.CreateF ileDialog(1)
pd.SetOFNInitia lDir = r'D:\Documents and Settings\John'
pd.DoModal()
print 'filename =',pd.GetFileNa me()
print 'path =', pd.GetPathName( )
pd=None
Traceback (most recent call last):
File "filedialog.py" , line 4, in ?
pd.SetOFNInitia lDir = 'D:\Documents and Settings\Eric'
TypeError: PyCFileDialog has read-only attributes
Also is there a way to open the XP file dialog that has the navigation
shortcuts on the left side of the dialog window?

Thanks
Eric
Jul 18 '05 #1
1 3965
SetOFNInitialDi r is a method:
pd.SetOFNInitia lDir(r'D:\Docum ents and Settings\John')
hth
Roger

"EricP" <fo************ *****@yahoo.com NOSPAM> wrote in message
news:1Dknb.3181 8$mZ5.158181@at tbi_s54...
I get the following error when I run this script to open a file dialog.
I've searched the web and news groups for this issue and have not found any references. I get the same behavior when I run it from Python or Pythonwin. I'm new to win32... and would appreciate any help I can get.

If I comment out the following line it works fine but I have to navigate to my initial directory.....

pd.SetOFNInitia lDir = r'D:\Documents and Settings\John'


# File Dialog Example
import win32ui
import win32con
pd = win32ui.CreateF ileDialog(1)
pd.SetOFNInitia lDir = r'D:\Documents and Settings\John'
pd.DoModal()
print 'filename =',pd.GetFileNa me()
print 'path =', pd.GetPathName( )
pd=None
Traceback (most recent call last):
File "filedialog.py" , line 4, in ?
pd.SetOFNInitia lDir = 'D:\Documents and Settings\Eric'
TypeError: PyCFileDialog has read-only attributes
Also is there a way to open the XP file dialog that has the navigation
shortcuts on the left side of the dialog window?

Thanks
Eric

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
13467
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen capture part. The code is as follows, the commented out lines at the end are things I have tried, but don't work. Whenever I try to create a...
0
1600
by: Howard Lightstone | last post by:
I am trying to use the CreatePrintDialog routine to initialize a device context for the (default) printer but ..... I can't figure out the arguments. win32ui.CreatePrintDialog The first argument is "idRes: the ID of the dialog resource to load" What IS this? There doesn't seem to be any information about it in PythonWin documents...
0
2241
by: Chris Gonnerman | last post by:
I am rewriting an antique BASIC program in Python for a customer. The main feature of the program is printing a work order for a particular assembly; the BASIC program uses IBM OEM line-drawing characters. The new program must reproduce the work order as closely as possible but be able to print to brainless inkjet printers. I found the MS...
2
2994
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation of the printing, I arranged the graphic elements on the page the way it should be. When I got to printing text, it went across the page, not down as...
3
2190
by: MsKitty | last post by:
My client is used to clicking on the script name on her PC and getting a windows command line box which it runs in. Not fancy but did the job until recently... Now it can take up to 4 minutes for the file dialog box to appear. No problems with speed in PythonWin, of course, but she is not used to doing that. Any suggestions? Anyone know why...
1
3726
by: Chris Lambacher | last post by:
Hi, This question has come up a few times on the list with no one giving a public answer. How do you use CreatePrintDialog from win32ui? About a year ago someone posted that: dlg = win32ui.CreatePrintDialog(1538) dlg.DoModal() will give you the window, but the ok button does not work.
4
3622
by: Joey C. | last post by:
Hello. I'm writing a program that creates a series of batch operations to convert movies to be used on iPodLinux. The programs that do the encoding and conversions are seperate from mine and all mine does is use os.system() to call the program. However, it needs to get an input file and an output file. Originally I was using just raw...
3
1878
by: robert | last post by:
As soon as I install wxPython on a Py2.3.5, my win32ui / win32gui apps freak out. buttons in dialogs are magically pressed. backgrounds of dialogs are colored wrong... this is with current wxPython (it was the same situation with a wx version some months back) When I uninstall wxPython the other win32ui/win32gui apps work again. What...
5
15682
by: nobugus | last post by:
Just posting a solution to the problem of capturing the whole virtual screen area, including all monitors with python and pywin32. Because this doesn't work even with PIL's imagegrab module. import win32gui, win32ui, win32con, win32api hwnd = win32gui.GetDesktopWindow() print hwnd # you can use this to capture only a specific window
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.