Hi folks,
I am trying to call a wx.Dialog from XRC, but I am running into
problems, that I don't understand. I hope one of you can shed some
light on this. The XRC file is fairly large, so I shall see if there
is something fundamentally wrong with my python code first.
When I run this code below, I obtain the dialog I want
("config_dialog.xrc" refers to my particular wx.dialog) and another
empty dialog box to which also the ShowModal() is tied:
import wx
from wx import xrc
class ConfigDialog(wx.Dialog):
def __init__(self, parent, id, title,
style=wx.DEFAULT_DIALOG_STYLE):
wx.Dialog.__init__(self, parent, id, title)
self._parent = parent
self.res = xrc.XmlResource("config_dialog.xrc")
self.dlg = self.res.LoadDialog(None, "ConfigDlg")
self.dlg.Show()
class MyApp(wx.App):
def OnInit(self):
dia = ConfigDialog(None, -1, "Config Dialog")
dia.ShowModal()
dia.Destroy()
return True
app = MyApp(0)
app.MainLoop()
When I change the line
self.dlg = self.res.LoadDialog(None, "ConfigDlg")
to
self.dlg = self.res.LoadDialog(self, "ConfigDlg")
I obtain the desired Dialog on its own, but my application freezes up
completely. Is there something wrong with my code? I wasn't able to
isolate any exact cause from my XRC file, but to be sure I do not
leave anything out, the most fancy control I try to use in there is a
wxNotebook.
Any suggestions are greatly appreciated. Thanks
Johannes