Hi,
I want to implement a function to invoke a
wxFileDialog without wxPython app. (I need to use it
within PyGame.) Strangely enough the dirDialog
functions but the file dialog doesn't: Python crashes
under Windows XP. I'm using Python2.2 and wxPython
2.4.2.4 Any ideas? I need to get this working quickly.
Stani
The code:
import wx
def
dirDialog(defaultPath='',message="www.stani.be",newDir=1):
"""Launchs a directory selector dialog
(wxpython)."""
style=wx.DEFAULT_DIALOG_STYLE
if newDir:style|=wx.DD_NEW_DIR_BUTTON
dlg =
wx.DirDialog(None,message=message,defaultPath=defaultPath,style=style)
if dlg.Show() == wx.ID_OK:path=dlg.GetPath()
else:path=''
dlg.Destroy()
return path
Just FYI, I tried both dialogs on Linux/RH8 with
wxPython2.4.1.2/Python2.3.1 and both seg fault.
Seems to me that the first arg, parent in both
the wx.DirDialog and wx.FileDialog calls can't be
None, but I may be wrong.
The doc for both does *not* state explicitly that
the arg parent can be NULL. But the wx.Dialog doc
does allow a NULL parent arg, specifically.
/Jean Brouwers
www.stani.be wrote:
···
Hi,
I want to implement a function to invoke a
wxFileDialog without wxPython app. (I need to use it
within PyGame.) Strangely enough the dirDialog
functions but the file dialog doesn't: Python crashes
under Windows XP. I'm using Python2.2 and wxPython
2.4.2.4 Any ideas? I need to get this working quickly.
Stani
The code:
import wx
def
dirDialog(defaultPath='',message="www.stani.be",newDir=1):
"""Launchs a directory selector dialog
(wxpython)."""
style=wx.DEFAULT_DIALOG_STYLE
if newDir:style|=wx.DD_NEW_DIR_BUTTON
dlg =
wx.DirDialog(None,message=message,defaultPath=defaultPath,style=style)
if dlg.Show() == wx.ID_OK:path=dlg.GetPath()
else:path=''
dlg.Destroy()
return path
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Hi,
I want to implement a function to invoke a
wxFileDialog without wxPython app. (I need to use it
within PyGame.) Strangely enough the dirDialog
functions but the file dialog doesn't: Python crashes
under Windows XP. I'm using Python2.2 and wxPython
2.4.2.4 Any ideas? I need to get this working quickly.
Please find another way to do it as nothing is guaranteed to work without an app object. In fact in 2.5 more of the initialization is delayed until the app object is created and so there most things are guarnteed to not work unless you have created an app object.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!