Telly Williams wrote:
Thanks, Josh,
What something extra would you want it do that you
can't already do with a normal instance?
Telly
Hi Telly,
First, it is good practice to leave enough of the previous message in your
reply so that someone reading only your reply can figure out what it is
about without having to go back and dig out all the previous messages in the
thread. On the other hand, don't go to the other extreme of keeping the
entire original message in your reply, otherwise it justs gets longer and
longer if there are a number of replies. Delete what is not relevant, keep
what is relevant to the point that you want to make.
As has been suggested, you really do need to read up on how Object
Orientation and Inheritance work in Python. However, I will try to explain.
You can create an instance of a wx.TreeCtrl like this -
tree = wx.TreeCtrl(parent,id,pos,size,style)
When this code is executed, Python checks to see if wx.TreeCtrl has a method
called __init__, and if so it calls it. You can be sure that wx.TreeCtrl
does have an __init__ method, and that it does a whole lot of important
stuff that you really do not want to know about 
Alternatively you can create a subclass of wx.TreeCtrl, like this -
class MyTreeCtrl(wx.TreeCtrl):
def __init__(self, parent, id, pos, size, style, log):
[do your own stuff here]
tree = MyTreeCtrl(parent,id,pos,size,style,log)
When this code is executed, Python checks to see if MyTreeCtrl has a method
called __init__, and if so it calls it. If it does not find one, it checks
the parent class, wx.TreeCtrl, to see if it has one, and if so, it calls it.
However, and this is the important point, if MyTreeCtrl has an __init__
method, as it does in your example, Python will call the method, but it will
*not* call the corresponding method in the parent class. This is how
inheritance works - you have 'overridden' the parent class's method with
your own. If you want the __init__ method in the parent class to be called,
it is up to you to call it explicitly from within your __init__ method. If
you do not do this, none of the important stuff in wx.TreeCtrl will happen,
and you can be sure it will not work properly.
Hope this helps
Frank Millman