Search code examples
pythonsliderwxpythonlimit

Slider with max value greater than 2147483647 in wxPython Phoenix?


Basically, the wx.Slider widget from wxPython Phoenix cannot go further than 2147483647.

Indeed,

slider = wx.Slider( parent   = parent,
                    value    = 10,
                    minValue = 0,
                    maxValue = 2147483647 )
print slider.GetMax()

Outputs :

2147483647

Whereas,

slider = wx.Slider( parent   = parent,
                    value    = 10,
                    minValue = 0,
                    maxValue = 2147483648 )
print slider.GetMax()

Outputs :

(program.py:5403): Gtk-CRITICAL **: IA__gtk_range_set_range: assertion 'min < max' failed
0

I need to use bigger values with that widget. Any workaround?


Solution

  • Have you considered just dividing your values by an appropriate divisor.

    Edit:
    There are times when you simply have to be pragmatic. You cannot possibly display or use a slider with a length of 2 billion. Whether it is automatically generated or not, it is simpler to make the slider utilise values between 0% and 100%, you can always manipulate the tooltip to display a value if that is essential but even then the accuracy of a given position when using such a massive number would in my opinion, be so inaccurate as to be meaningless.