Flickering when using as widget
See original GitHub issueI am trying to animate a graph using ipywidgets but the output is flickering.
Is there a native way to embed the widget in ipywidgets? I am trying to figure it out from the docs, but they seem to be incomplete. The CytoscapeWidget has a callback to widgets, perhaps you can send me in the right direction?
from ipycytoscape import CytoscapeWidget
import networkx as nx
class Visualizer:
def __init__(self, graph):
self.graph = graph
self.widget= CytoscapeWidget()
self.widget.graph.add_graph_from_networkx(graph)
self.update_nodes()
style = [
dict(selector = 'node',
css = {
"background-color": "data(color)",
"text-outline-width" : 10
}),
dict(selector = ':selected',
css = {"background-color" : 'red',
"line-color" : "black",
"source-arrow-color" : "yellow",
"target-arrow-color" : "purple"})]
self.widget.set_style(style)
def update_nodes(self, data = None):
if data:
for idx, c in enumerate(data):
node = self.widget.graph.nodes[idx]
node.data['color'] = c
else:
for node in self.widget.graph.nodes:
if np.random.rand() < .5:
node.data['color'] = 'red'
else:
node.data['color'] = 'blue'
g = nx.complete_graph(10)
v = Visualizer(g)
ts = iw.IntSlider(min = 0, max = 10, step = 1)
print(iw.widgets.interaction.__file__)
def callback(*args, **kwargs):
kwargs.get('x')
v.update_nodes()
display(v.widget)
plot = iw.interactive(callback, x = ts)
plot
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
iOS Home Screen Widget Flicker in Gallery - Apple Developer
My iOS 14 home screen widget intermittently flickers in the widget gallery view. This happens sometimes when I run the widget from the...
Read more >Widgets flickering in new iPhone. Should I use the warranty ...
Have you tried synchronizing your blinking with the flashing of the screen to eliminate all traces of it?
Read more >Widget flickers on my website - LightWidget
How to fix the flickering? · They want to have different size of the widget for desktop and different for mobile. It can...
Read more >Flickering Widgets | MacRumors Forums
"The flickering is often triggered after installing app updates or when the user re-configures a widget in its main app.".
Read more >Is there a way to solve the iOS 14 Widget flicker issue?
The problem seems to occur after an app update gets installed. During development I thought this is a problem with the iOS Simulator,...
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
Ok I torched my env and reinstalled it. All is good now. Update looks good! Also saves the layout thanks a bundle!
@cvanelteren you’re spot on with the diagnosis. I think there are actually two redraws happening.
interactive
ipywidgets will redraw the outputts.observe(callback, names='value')