Provide example of widget executing nonblocking code
See original GitHub issueSummary
Add something like this example to the documentation:
import threading
from IPython.display import display
import ipywidgets as widgets
import time
progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
def work(progress):
total = 100
for i in range(total):
time.sleep(0.2)
progress.value = (i+1)/total
thread = threading.Thread(target=work, args=(progress,))
display(progress)
thread.start()
Original Issue
From what we understand, ipywidgets is a serverextension + nbextension + custom messages that use the shell
channel, which blocks on kernel executing code. Is it possible at all, to create a widget that is constantly refreshing its output regardless of whether the kernel’s shell
channel is busy or not?
We’d be willing to contribute changes to ipywidgets
if you can devise a way to make this possible.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:13 (10 by maintainers)
Top Results From Across the Web
QT - Show Widget without blocking his GUI - Stack Overflow
You can take a look at Qt QProgressDialog class. If you need that the widget do not block the main GUI, you can...
Read more >Overview of Blocking vs Non-Blocking - Node.js
Blocking. Blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes.
Read more >4. Loading Scripts Without Blocking - Even Faster Web Sites ...
The reason browsers block while downloading and executing a script is that the script may make changes to the page or JavaScript namespace...
Read more >Executing Nonblocking System Commands (Mastering Perl/Tk)
Here's a private method that reads command output and inserts it into the Text widget. It calls kill_command to perform cleanup operations when...
Read more >Modal and Blocking Widgets - IDL Coyote
Was it possible to write a program that stopped and waited for user input when called both from within a widget program and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This example works: https://gist.github.com/maartenbreddels/3378e8257bf0ee18cfcbdacce6e6a77e It also works when you set thread_safe to False, but I know from experience that it will fail sometimes.
I think that it is worth creating an example notebook for something like this (and a progress bar) …