I want to get the value of a TextCtrl every time this TextCtrl gets changed. My code returns me the "old" value (like before I pressed the key) - but I want to get the "new" value with the key I pressed. For example, when the Value of my TC is "123" and I add a "4", I still get "123" returned, but I want to get "1234".
class pageThree(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent,size=(800,600))
self.pageThree=wx.Panel(self,size=(800,600))
self.TC = wx.TextCtrl(self.pageThree,-1,pos=(100,150),size=(60,20))
self.TC.Bind(wx.EVT_KEY_DOWN, self.getValue)
def getValue(self, event):
print self.TC.GetValue()
As I only work with integers in this TC, I tried to add + event.GetKeyCode() - 48, but this does not work when I delete a value instead of adding one =/