Hi All,
I need to do some processing before a Dialog is Displayed but not during instantiation.
I tried to override wx.Dialog.Show() but it seems to ignore TestDialog.Show().
ie.
class TestDialog(wx.Dialog):
def init(self, parent):
wx.Dialog.init(self, parent)
okButton = wx.Button(self, wx.ID_OK, “OK”, pos=(15, 15))
okButton.SetDefault()
cancelButton = wx.Button(self, wx.ID_CANCEL, “Cancel”,pos=(115, 15))
def Show(self, show):
print "show", show
if show:
self.Init()
return wx.Dialog.Show(show)
def Init(self):
print "Init"
…
…
…
dlg = TestDialog(self)
dlg.ShowModal()
dlg.Destroy()
…
Thanks in Advance,
George
Hi Cody,
Thanks, How thick of me.
I am using the override instead of the event.
···
On Thu, Jan 22, 2009 at 1:06 AM, Cody Precord codyprecord@gmail.com wrote:
Hello,
On Jan 21, 2009, at 3:55 AM, George Verdad wrote:
Hi All,
I need to do some processing before a Dialog is Displayed but not during instantiation.
I tried to override wx.Dialog.Show() but it seems to ignore TestDialog.Show().
ie.
class TestDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
okButton = wx.Button(self, wx.ID_OK, "OK", pos=(15, 15))
okButton.SetDefault()
cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel",pos=(115, 15))
def Show(self, show):
print "show", show
if show:
self.Init()
return wx.Dialog.Show(show)
def Init(self):
print "Init"
…
…
…
dlg = TestDialog(self)
dlg.ShowModal()
dlg.Destroy()
Your calling TestDialog.ShowModal not TestDialog.Show. There is also EVT_SHOW that you can bind to if you need to do something when a window is shown.
Cody
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users