Code Monkey home page Code Monkey logo

Comments (5)

shashi avatar shashi commented on August 23, 2024

Lift instantiates a new ToggleButtons with its own signal each time the first toggle button updates, so you will have to create a signal and have the toggle buttons update that.

ff = ["F1","F2","F3","F4"]
f1 = togglebuttons(ff)
f1_inp = Input("F2")  # This is what f2 will update.
display(f1)
f2 = lift(x->togglebuttons(signal=f1_inp, filter(a->a!=x,ff)),f1)
display(f2)
display(signal(f1))
display(f1_inp)

Should help you.

I'm not entirely sure why when I select F3 in the first set, I get the ordering F1, F4, F2. Will look into this.

from interact.jl.

babaq avatar babaq commented on August 23, 2024

i tried your suggested solution, but didn't work either.

from interact.jl.

shashi avatar shashi commented on August 23, 2024

Could you be more specific about what happens when you run the code? It works for me. Also which browser are you using? Do togglebuttons generally update like they should?

from interact.jl.

babaq avatar babaq commented on August 23, 2024

i am using Julia-0.4-dev on x64 win7 with Chrome(37.0.2062.103 m)

  • Gadfly 0.3.7
  • IJulia 0.1.15
  • Interact 0.1.4

it's behave the same way i posted originally. second togglebuttons updated, but in strange order, and also cann't output F1.

capture

from interact.jl.

JobJob avatar JobJob commented on August 23, 2024

This works on master:

using Interact
ff = ["F1","F2","F3","F4"]
f1 = togglebuttons(ff)
f1_inp = Signal("F2")
f2 = map(signal(f1)) do x
    togglebuttons(filter(a->a!=x, ff); signal=f1_inp)
end
display.([f1, f2, signal(f1), f1_inp]);

The ordering is a bug in ipywidgets, would be good if you can report it there, Python code:

from IPython.display import display
from ipywidgets import ToggleButtons
tb = ToggleButtons()
tb.options = [1,2,3]
display(tb)
tb.options = [0,1,2]

screen shot 2016-12-11 at 2 37 28 am

The order should be 0,1,2

from interact.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.