Merge pull request #20 from Leonti/patch-2

Add `delta` parameters to sliders
pull/21/head
Peter Hinch 2022-09-12 08:23:30 +01:00 zatwierdzone przez GitHub
commit 8e3d8a04c3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -1867,6 +1867,8 @@ Optional keyword only arguments:
* `args=[]` A list/tuple of arguments for above callback.
* `value=0.0` The initial value: slider will be at the bottom (v), left (h).
* `active=True` Determines whether the control can accept user input.
* `min_delta=0.01` Minimim value increment
* `max_delta=0.1` Maximum value increment (long button presses)
Methods:
* `greyed_out` Optional Boolean argument `val=None`. If `None` returns the

Wyświetl plik

@ -22,9 +22,10 @@ class Slider(LinearIO):
height=100, width=20, divisions=10, legends=None,
fgcolor=None, bgcolor=None, fontcolor=None, bdcolor=None,
slotcolor=None, prcolor=None,
callback=dolittle, args=[], value=0.0, active=True):
callback=dolittle, args=[], value=0.0, active=True,
min_delta=0.01, max_delta=0.1):
width &= 0xfe # ensure divisible by 2
super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor, value, active, prcolor)
super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor, value, active, prcolor, min_delta, max_delta)
super()._set_callbacks(callback, args)
self.divisions = divisions
self.legends = legends
@ -96,9 +97,10 @@ class HorizSlider(LinearIO):
height=20, width=100, divisions=10, legends=None,
fgcolor=None, bgcolor=None, fontcolor=None, bdcolor=None,
slotcolor=None, prcolor=None,
callback=dolittle, args=[], value=0.0, active=True):
callback=dolittle, args=[], value=0.0, active=True,
min_delta=0.01, max_delta=0.1):
height &= 0xfe # ensure divisible by 2
super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor, value, active, prcolor)
super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor, value, active, prcolor, min_delta, max_delta)
super()._set_callbacks(callback, args)
self.divisions = divisions
self.legends = legends