I think my confusion is more in the arguments to any given instantiation. For
instance where the wx.TextCtrl is referenced above, I go look at the
prototype for wx.TextCtrl and it shows that it receives 9 arguments:
wxTextCtrl(self, parent, id, value=EmptyString, pos=DefaultPosition,
size=DefaultSize, style=0, validator=DefaultValidator, name=TextCtrlNameStr)
So, I would normally think arguments are identified by any given subroutine
the either the order they are written or their name. In Python it appears to
be a combination of the two. I can see there are default arguments for
everyting but parent and id, and I can grok that part. I can also grok that
self is the first argument to every subroutine (or instantiation). Above, I
would think parent is splitter2, id=-1 and the style would be as shown.
Therefore value, pos, size, validator and name are still the defaults.
But I get back to the fact that in the first question where call MyLog is
defined:
class MyLog (wx.Pylog):
def __init__ (self, textCtrl, logTime=0)
wx.Pylog.__init__ (self)
self.tc = textCtrl
self.logTime = logTime
That I dont see where textCtrl or logTime fit into either line 1259
self.log = wx.TextCtrl(splitter2, -1,
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
or line 1266
wx.Log_SetActiveTarget(MyLog(self.log))
Leaving me still shaking my head where textCtrl and logTime come from.
I realize I must be dense here, but I would really appreciate some guidance
while I work my way through the "forest of confusion".
Charles Krinke
ยทยทยท
On Saturday 19 February 2005 19:29, Robin Dunn wrote:
cfk wrote:
> I am trying to understand arguments to classes in wxPython and am
> confused. Here is an example of my confusion.
>
> In the Python demo, Main.py has a class definition of MyLog (around line
> 250)
>
> class MyLog (wx.Pylog):
> def __init__ (self, textCtrl, logTime=0)
> wx.Pylog.__init__ (self)
> self.tc = textCtrl
> self.logTime = logTime
>
> Then later at about line 1266 is the statement
>
> wx.Log_SetActiveTarget(MyLog(self.log))
>
> These are the only two references to MyLog in main.py. I looked up PyLog
> and its superclass Log in wxpython.org/docs/api and dont see textCtrl or
> logTime defined it the __init__ for either the class PyLog or its
> superclasses.Which is why MyLog doesn't pass them to wx.PyLog.__init__. The are used
only by MyLog.> So, here is my confusion. Where is textCtrl initialized.
That is the self.log that is passed to MyLog. In Main.py it is created
like this:# Set up a log window
self.log = wx.TextCtrl(splitter2, -1,
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)