RepeatButton¶
- class ibb.widgets.RepeatButton(**kwargs: Any)[source]¶
A button that will repeat the click event when held down.
- Parameters
frequency (Float) – Click event frequency in Hz when holding down the button; Default 1
delay (Float) – Time in seconds before the repeating begins; Default 1
Note
Whenever you click the button, you get a first click event. After delay seconds, another click event gets fired repeatedly at your given frequency.
Examples¶
Warning
Note that the widgets are not responding as we do not have a python backend running!
[1]:
import ipywidgets
import ibb
[2]:
out = ipywidgets.Output()
btn = ibb.widgets.RepeatButton(
description='Click me',
icon='check',
delay=3,
frequency=2,
)
def click_handler(btn):
# Set number of times pressed
try:
click_handler.counter += 1
except AttributeError:
click_handler.counter = 1
out.clear_output()
with out:
print(f'PRESSED {click_handler.counter}')
btn.on_click(click_handler)
[3]:
ipywidgets.VBox([btn, out])
[3]: