press space key to pause
This commit is contained in:
parent
f58ee891b3
commit
37b6fdb145
@ -867,15 +867,33 @@ if __name__ == "__main__":
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# start button callback
|
app.clientside_callback(
|
||||||
|
"""
|
||||||
|
function(id) {
|
||||||
|
document.addEventListener("keyup", function(event) {
|
||||||
|
if (event.key == ' ') {
|
||||||
|
document.getElementById('start-button').click()
|
||||||
|
event.stopPropogation()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return window.dash_clientside.no_update
|
||||||
|
}
|
||||||
|
""",
|
||||||
|
Output("start-button", "id"),
|
||||||
|
Input("start-button", "id")
|
||||||
|
)
|
||||||
|
|
||||||
|
# start / stop button callback
|
||||||
@callback(Output('interval-component', 'disabled'),
|
@callback(Output('interval-component', 'disabled'),
|
||||||
Output("start-button", "children"),
|
Output("start-button", "children"),
|
||||||
Output('controls-and-radio-item', 'disabled'),
|
Output('controls-and-radio-item', 'disabled'),
|
||||||
Input("start-button", "n_clicks"),)
|
Input("start-button", "n_clicks"),
|
||||||
|
State("start-button", "children"),)
|
||||||
|
|
||||||
def start_cycle(n):
|
def start_cycle(n, value):
|
||||||
if n:
|
if n:
|
||||||
if n%2 == 0:
|
# if n%2 == 0:
|
||||||
|
if value == "Pause":
|
||||||
return True, "Auto Play", False
|
return True, "Auto Play", False
|
||||||
else:
|
else:
|
||||||
return False, "Pause", True
|
return False, "Pause", True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user