On Aug 18, 2008, at 9:13 AM, Adrian Greyling wrote:
def MainToSecond(self, event): # wxGlade:
MyMainFrame.<event_handler>
MySecondFrame(self).Show()
MySecondFrame.text_ctrl_2.SetValue("This text was generated
from the 'MainFrame' window")
The expression MySecondFrame(self) creates a new object. It
initializes the new object by calling the MySecondFrame's __init__
method.
class MySecondFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MySecondFrame.__init__
...
self.text_ctrl_2 = wx.TextCtrl(self, -1, "",
style=wx.TE_MULTILINE)
...
The __init__ method calls sets the variable text_ctrl_2 in the object
m.
Your function MainToSecond is trying to get the attribute
MySecondFrame.text_ctrl_2.
This attribute does not exist. You want to get the attribute
m.text_ctrl_2. So, the method
should be:
def MainToSecond(self, event): # wxGlade:
MyMainFrame.<event_handler>
m = MySecondFrame(self)
m.Show()
m.text_ctrl_2.SetValue("This text was generated from the
'MainFrame' window")
Also, method and function names should always start with a lower case
letter: always
mainToSecond and never MainToSecond
-jeff
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor