Skip to content

How to dynamically change the text? #525

Answered by wang0618
d4nila asked this question in Q&A
Discussion options

You must be logged in to vote

It shouldn't be unless the network latency between you and the app is very high.
Anyway, here is a hacky way to avoid this delay:

def update_scope_text(scope_name, text):
    run_js(f"$('#pywebio-scope-{scope_name}').text({text!r})")

put_scope('text')
while True:
    update_scope_text('text', str(time.time()))
    time.sleep(1)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@d4nila
Comment options

Answer selected by d4nila
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants