The problem is that you are calling the GetValue method inside your lambda. That executes immediately which means it will grab the value from the text control before it's even shown. In other words, it will always be empty. It is not called every time the event fires.
Instead, you should just call GetValue() inside the event handler itself:
import wx
class ClassName(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title)
self.panel = wx.Panel(self)
self.PhotoMaxSize = 240
self.createWidgets()
self.Show()
def createWidgets(self):
self.palletNumberText = wx.TextCtrl(self.panel, size=(80,-1))
self.palletNumberText.Bind(wx.EVT_TEXT, self.onPalletNumberText)
def onPalletNumberText(self, event):
'''
save palletNumbertTxt Value when text is entered
'''
print self.palletNumberText.GetValue()
print "This is a test"
# Store Value
return
#----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.App(False)
frame = ClassName(None, "Test")
app.MainLoop()