Im having some real head-ache inducing issues with my code. I want to update a statictext label to display the value of a slider bar.
Here is my code...
Speed_Slider_Panel = wx.Panel(Automatic_Control_Panel) Speed_Slider = wx.Slider(Speed_Slider_Panel, ID_SPEED_SLIDER, 0, 0, 10, style = wx.HORIZONTAL | wx.SL_AUTOTICKS) Speed_Slider.SetTickFreq(1, 1) self.Bind(wx.EVT_SLIDER, self.OnSpeedSlider, id=ID_SPEED_SLIDER)
the 'family tree' goes;
Speed_Slider_Panel / Speed_Judder_Panel
This is the label;
Speed_Judder_Panel = wx.Panel(Automatic_Control_Panel) Speed_Judder_Sizer = wx.BoxSizer(wx.HORIZONTAL) Speed_Label = wx.StaticText(Speed_Judder_Panel, ID_SPEED_LABEL, "Speed = %d" % Speed) Speed_Label.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, False))
And try as i might i cannot get the label value to change with the slider. I keep getting told various things arent defined or that certain things dont have certain attribute...
def OnSpeedSlider(self, event): Speed_Label.SetLabel("Speed = %d" % event.GetValue())
That snippett is wrong for sure but i dont know what to do to it to get it to work :-s
Any help is greatly appreciated!