On Fri, Mar 30, 2012 at 3:13 AM, Deni Didro
I don't understand from where come "FRAME" in "self.frame = frame"
I can't find to be used "frame" like argument.
Class DemoTaskBarIcon is used this way "self.tbicon =
DemoTaskBarIcon(self)"
the DemoTaskBarIcon __Init__ specifies:
def __init__(self, frame):
this is a method, so in this case, "self" is the object being
initialized (the new DemoTaskBarIcon object). It is filled in
automatically by python, so this __init__ takes one argument, "frame",
presumabley teh frame you want the TaskBarIcon user with.
when it is called:
"self.tbicon = DemoTaskBarIcon(self)"
then "self" is defined in the calling scope -- I presume this is in a
wx.Frame __init__, (or other method) and thus "self" is a frame -- teh
one you want the Icon for.
the trick here is that the name used when calling a funciton is
independent of the the name used in funtion itself:
def f(a):
return a+ 2
when I call it, I can call it with whatever input name I want:
In [75]: f(23)
Out[75]: 25
In [76]: a = 2
In [77]: b = 3
In [78]: f(a)
Out[78]: 4
In [79]: f(b)
Out[79]: 5
so this trick it identifying what is what is to look at the name in
the current scope.
HTH,
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov