Closed maky-hnou closed 2 years ago
Is it possible to move the sliding_button by a fixed value?
Not easily right now, it is one of the niggly things on my mental todo list to fix up. I think I'd like it to work with a little 'grace period' so if you just push down and release the mouse button quickly it moves up by a fixed (definable - with a default) increment but if you hold the mouse button longer than 0.5 seconds it starts increasing at a fairly fast clip like now.
Thanks for the issue though, it will likely remind me when I go round doing a polishing pass on some of the older UI elements.
If you want to implement it yourself for your application you could likely subclass the element as MakyUISlider
and override just the process_events()
and update()
methods to make these changes (That's just from memory I haven't looked at this yet).
Hello, I've been struggling with creating UI components using pygame, till I found pygame_gui. So thank for making is easier.
I've been trying pygame_gui for few days to discover its functionalities.
However, I've been stuck in trying to move the sliding_button of the ui_horizontal_slider by a fixed value each time the left_button/right_button is pressed. Here is a brief description of what I want to do:
I created a horizontal slider. Let's say that the value_range is [5, 10] and the start_value is 5. I want that the slider value get's incremented by 1 every time the right_button of the slider is pressed (till it reaches 10) and the same when pressing the left_button of the slider, till it reaches 5.
I looked in to the code, and I couldn't find the option of moving the sliding_button by a fixed value. So I tried to create one, but it didn't work: when I click on the left/right button just for once, the sliding_button reaches the limit directly.
Here is the code I am using:
Is it possible to move the sliding_button by a fixed value?