question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not clear how to transition from interact to custom layout widgets

See original GitHub issue

For example, this does not work:

vb1 = VBox([x, xmin,xmax])
vb2 = VBox([y, ymin, ymax])
vb3 = VBox([c, cmin, cmax])

box = HBox([vb1, vb2, vb3])
display(box)

for cols in box.children:
    for wdg in cols.children:
        wdg.observe(plot, names='value')

The intended behavior is like this:

interact(plot, 
                       x=x,
                       y=y,
                       c=c,
                       xmin=xmin,
                       xmax=xmax,
                       ymin=ymin,
                       ymax=ymax,
                       cmin=cmin,
                       cmax=cmax                  
)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jasongroutcommented, Nov 28, 2017

I think it is probably better to build a grid container widget that can be used outside of interact as well, perhaps using the new css grid spec for layout. Between having such a container, and using tools mentioned in #1021, I think it could be relatively easy to make a grid of controls in an interact-type situation.

0reactions
gioxc88commented, Apr 3, 2020

I would like to add something because I also encountered the same problem. I will use the same example of @denfromufa

First of all you don’t need to refer to the w.children but in the final HBox you can directly use the widgets x, y, c etc … You only need w.children[-1] for the output

w = interactive(plot2dcolors, 
                       x=x,
                       y=y,
                       c=c,
                       xmin=xmin,
                       xmax=xmax,
                       ymin=ymin,
                       ymax=ymax,
                       cmin=cmin,
                       cmax=cmax           
)

box=VBox([HBox((x, y, c)), HBox((xmin, ymin, cmin)), HBox((xmax, ymax, cmax), w.children[-1]])

finally when you display your box this will only display the widgets and not the output of the function until you interact with the box

so for example if you call display(box) you will see the widgets but not the plot (only until you click on any widget) to solve this yo have to call w.update() in fact the interactive class has an event called on_display that calls the update method

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reuse layouts with <include> - Android Developers
Although Android offers a variety of widgets to provide small and reusable interactive elements, you might also need to reuse larger ...
Read more >
Output widgets: leveraging Jupyter's display system - ipywidgets
You can also append output directly to an output widget, or clear it programmatically ... One simple way to customize how an interact...
Read more >
Layout Management - Qt for Python
Custom Widgets in Layouts#. When you make your own widget class, you should also communicate its layout properties. If the widget uses one...
Read more >
Page Builder - BigCommerce Support
Using Page Builder; Theme Styles; Adding widgets; Layers; Layout widget; Text widget ... Go to Storefront › Themes › Customize to launch Page...
Read more >
Optimize Cumulative Layout Shift - web.dev
That's not great, but when the responsive image is loaded they will be reset, so it will be given the correct dimensions—just later...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found