In the wxPython book, there is a section on sliders. Here’s the code:
import wx
class SliderFrame(wx.Frame):
def init(self):
wx.Frame.init(self,None,-1,‘Slider Example’,size=(340,320))
panel = wx.Panel(self,-1)
self.count = 0
slider = wx.Slider(panel,100,25,1,100,pos=(10,10),size=(250,-1),
style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
slider.SetTickFreq(5,1)
slider = wx.Slider(panel,100,25,1,100,pos=(125,50),size=(-1,250),
style=wx.SL_VERTICAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
slider.SetTickFreq(20,1)
if name == ‘main’:
app = wx.PySimpleApp()
frame = SliderFrame()
frame.Show()
app.MainLoop()
For some reason, this doesn’t display the min/max values at the end of the slider nor does it display a value in a box so that the user can see it. What’s wrong here?