Help with code, wx.TextCtrl - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Help with code, wx.TextCtrl (/showthread.php?tid=169888) |
Help with code, wx.TextCtrl - mwkurt - 2013-07-26 Hello, I hope that this is not against protocol for this particular forum, but I am in need of some coding help as a beginner. Here is my problem I have two text boxes. Text_1 and Text_2. Text_1 is an input box and Text_2 should duplicate Text_1 as a string is entered into Text_1. The problem I have with my code is I keep getting this error: AttributeError: 'Frame 1' object has no attribute 'bind' The bolded line seems to be where my problem is. I get the same result in Boa and pyscripter. Could someone take a look at my code and tell me the error of my ways? Thanks, Mark #Boa:Frame:Frame1 import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1PANEL1, wxID_FRAME1TEXT_1, wxID_FRAME1TEXT_2, ] = [wx.NewId() for _init_ctrls in range(4)] class Frame1(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(444, 307), size=wx.Size(406, 250), style=wx.DEFAULT_FRAME_STYLE, title='Frame1') self.SetClientSize(wx.Size(390, 212)) self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(390, 212), style=wx.TAB_TRAVERSAL) self.text_1 = wx.TextCtrl(id=wxID_FRAME1TEXT_1, name=u'text_1', parent=self.panel1, pos=wx.Point(80, 32), size=wx.Size(240, 21), style=0, value=u'') self.text_2 = wx.TextCtrl(id=wxID_FRAME1TEXT_2, name=u'text_2', parent=self.panel1, pos=wx.Point(72, 128), size=wx.Size(240, 21), style=0, value=u'') self.bind(wx.EVT_TEXT, self.intext, self.text_1) def __init__(self, parent): self._init_ctrls(parent) def intext(self, event): txt = self.text_1.GetValue() self.text_2 = txt if __name__ == '__main__': app = wx.PySimpleApp() frame = create(None) frame.Show() app.MainLoop() RE: Help with code, wx.TextCtrl - markdl - 2013-07-29 Change self.bind to self.Bind. Capitalization is important. |