I'm new to python and I'm not sure how to pass data between objects. Below is a tabbed program using python and wxwidgets. How would I be able to access the maintxt instance from the GetText method since their in different classes?
Thanks.
........
#!/usr/bin/env python
import wx
class PageText(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.maintxt = wx.TextCtrl(self, style=wx.TE_MULTILINE, pos=(0, 40), size=(850,320))
self.Show(True)
class PageList(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.bPutText = wx.Button(self, id=-1, label='Put Text', pos=(855, 40), size=(75, 30))
self.bPutText.Bind(wx.EVT_LEFT_DOWN, self.GetText)
def GetText(self, event):
# Write text into maintxt
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="ADMIN")
p = wx.Panel(self)
nb = wx.Notebook(p)
vPageText = PageText(nb)
vPageList = PageList(nb)
nb.AddPage(vPageText, "Edit Text")
nb.AddPage(vPageList, "Book List")
sizer = wx.BoxSizer()
sizer.Add(nb, 1, wx.EXPAND)
p.SetSizer(sizer)
if __name__ == "__main__":
app = wx.App()
MainFrame().Show()
app.MainLoop()