Boštjan Mejak wrote:
I would like for my overridden *wx.TaskBarIcon()* class, named
*MyTaskBarIcon()*, to be *linked* with my overridden *wx.Frame()* class,
named *MyFrame()*, so that I can do *self.Close()* in *MyTaskBarIcon()*
class. I would like that the method call *self.Close()* gets delegated
to *MyFrame()* from a custom method in *MyTaskBarIcon()*.
Pass a reference to the frame you'd like to close into the constructor of MyTaskBarIcon, then use it later.
class MyTaskBarIcon(wx.TaskBarIcon):
def __init__(self, parent, frame, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.frame = frame
...
def Close(self):
self.frame.Close()
The super() syntax is for Python 3. In Python 2.x use:
super(MyTaskBarIcon, self).__init__(parent, *args, **kwargs)
···
--
James Scholes
http://twitter.com/JamesScholes