Re: associating a slider with a label
Dietmar Schwertberger <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
On 28.10.2020 11:32, Nathan smith wrote: > You mention drawing the labels yourself, how would I go about starting > that. Is that with a WX.Rectangle and then doing some fancy footwork > to capture when the slider has focus and then forcing the reader to > speak? I think it's easier. Just place title, left label, slider and right label in a sizer, but create the controls in the order: title, slider, left label, right label. E.g. I have just tried this and it seems to work: sizer_2 = wx.BoxSizer(wx.HORIZONTAL) label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, "Label:") sizer_2.Add(label_3, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 4) self.slider_1 = wx.Slider(self.panel_1, wx.ID_ANY, 0, 0, 10, name="Label:") label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, "0") sizer_2.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_2.Add(self.slider_1, 0, 0, 0) label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, "100") sizer_2.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0) For displaying the current value, you probably better add a TextCtrl. (Keep your 'name' arguments, as it otherwise will not work with e.g. 4.0.7.) Regards, Dietmar -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/d17ca31d-c193-6ca6-b864-16f1fb35859c%40schwertberger.de.