I have multiple widgets in a form like so:
self.sl_qZone1 = wx.Slider(self, -1, 50, integer=True, 0, 100, size=(sliderWidthHeight), style=wx.SL_HORIZONTAL)
self.tc_qZone1 = wx.TextCtrl(panel, -1, 50, (0,0), style=wx.TE_CENTER)
I have some events bound like so to a dozen or so sliders/text controls:
wx.FindWindowByName(mvName['sl0']).Bind(wx.EVT_SLIDER, lambda event: self.sliderUpdate(event, wx.FindWindowByName(mvName['sl0']), wx.FindWindowByName(mvName['tc0']),), wx.FindWindowByName(mvName['sl0']))
wx.FindWindowByName(mvName['tc0']).Bind(wx.EVT_CHAR, lambda event: self.tcVolUpdate(event, wx.FindWindowByName(mvName['sl0']), wx.FindWindowByName(mvName['tc0']),), wx.FindWindowByName(mvName['tc0']))
And then I have these functions:
def sliderUpdate(self, event, slider, textctrl):
textctrl.SetValue(str(slider.GetValue()))
def tcVolUpdate(self, event, slider, textctrl):
slider.SetValue(int(textctrl.GetValue()))
It works great when I modify the slider -- it updates the textctrl with the appropriate value. But when I try to edit the textctrl, it lets me select the text but not actually edit it. I've tried wx.EVT_TEXT_ENTER
as well with no luck.
How do I make the text ctrl updatable and have it update the value of the slider?