[wxPython] wxFileDialog as CLASS

Hi folks,

I'm a brand new newbie and I have the following problem:

I would like to use my(copyed and pasted) working code of a FileDialog
"
dlg = wxFileDialog(self, "Load Settings-File", ".", "", "*.*", wxOPEN|wxMULTIPLE)
if dlg.ShowModal() == wxID_OK:
for path in dlg.GetPaths():
print bla bla
self.settings.variable = path
dlg.Destroy()
"

in an own class, BUT
"
...
...

x = MyFileDialog(self,"Open your TestScene", ".", "", "*.*", wxOPEN|wxMULTIPLE)
self.settings.S_TestScenePath = x.path

...
...
class MyFileDialog(wxFileDialog):
def __init__(self,parent,message,defaultDir,defaultFile,wildcard,style):

self.path = ""

if self.ShowModal() == wxID_OK:
for each in self.GetPaths():
self.path = each
dlg.Destroy()
...
...
"

won't work. Can anyone help me, please?

Sorry if the code make no sence!!

That's all folks - Thanx

···

_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de

class MyFileDialog(wxFileDialog):
def __init__(self,parent,message,defaultDir,defaultFile,wildcard,style):

self.path = ""

if self.ShowModal() == wxID_OK:
for each in self.GetPaths():
self.path = each
dlg.Destroy()
won't work. Can anyone help me, please?

in your derived class, you need to call wxFileDialog's __init__ method, since
you are overriding it with your own:

class MyFileDialog(wxDialog):
    def __init__(self, parent, ... ):
        wxDialog.__init__(self, parent, ....)
        self.path = ""

...

···

On Thursday 23 August 2001 07:00, you wrote:

_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Cliff Wells
Software Engineer
Logiplex Corporation
(800) 735-0555

Oops, meant to say wxFileDialog rather than wxDialog....

class MyFileDialog(wxFileDialog):
    def __init__(self, parent, ... ):
        wxFileDialog.__init__(self, parent, ....)
        self.path = ""
   
...

Regards,
Cliff

···

--
Cliff Wells
Software Engineer
Logiplex Corporation
(800) 735-0555