update label while user is typing in textfield in python

147 views Asked by At

I'm looking for a way to show the text that the user is typing in a label or a readonly textctrl but without pushing a button. Is this possible?

EDIT: Using wxpython

1

There are 1 answers

0
VeVi On

I found the answer.

One can use wx.EVT_TEXT

self.txtNameNewMA = wx.TextCtrl(self.panel, wx.ID_ANY)
self.lblNameNewMAPreview = wx.StaticText(self.panel, label="")

self.bind(wx.EVT_TEXT, self.onmessage)
def onmessage(self, message)
   self.lblNameNewMAPreview.SetLabel(self.txtNameNewMA.GetValue())