def fetchHandler(event):
print item3.GetValue()
def MyKeypadFunc( parent, call_fit = True, set_sizer = True ):
item0 = wx.BoxSizer( wx.VERTICAL )
item1 = wx.GridSizer( 0, 3, 0, 0 )
item2 = wx.StaticText( parent, ID_TEXT, "Password", wx.DefaultPosition, wx.DefaultSize, 0 )
item1.Add( item2, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
item3 = wx.TextCtrl( parent, ID_TEXTCTRL, "", wx.DefaultPosition, [80,-1], 0 )
item1.Add( item3, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
item1.Add( [ 20, 20 ] , 0, wx.ALIGN_CENTER|wx.ALL, 5 )
item4 = wx.Button( parent, ID_BUTTON1, "1", wx.DefaultPosition, wx.DefaultSize, 0 )
item1.Add( item4, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
item4.Bind(wx.EVT_BUTTON, fetchHandler)
Error I get:
Traceback (most recent call last):
File “keypad_wdr.py”, line 15, in fetchHandler
print item3.GetValue()
NameError: global name ‘item3’ is not defined