# Slider in Julia with Luxor

**URL:** <https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079>\
**Category:** General Usage\
**Created:** [November 2, 2018, 3:50am UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079 "2018-11-02T03:50:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![microlifecc](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Post date:** [November 2, 2018, 3:50am UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079/1 "2018-11-02T03:50:46Z")

</div>

Hi!

I am trying to implement elementary graphics stuffs in Julia, like displaying a circle whose size would change based on the value set by the user on a slider.  
My code:

```julia
using Luxor, Interact;
@png begin
    s = slider(0:.1:1,label="Slider X:")
    #display(s)
    #display(observe(s));
    #text("Hello world")
    circle(0, 0, observe(s), action=:nothing)
    #display(s)
    #circle(Point(0, 0), 200, :stroke)
end

```

Can you guys suggest a better way to try this? My permutations keep giving errors.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 2, 2018, 8:19am UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079/2 "2018-11-02T08:19:33Z")

</div>

Yes, it used to work well a long time ago. In fact it used to run into “IOPub data rate exceeded” messages it was that “working” :).

It sometimes works now:

 ![ijulia](https://global.discourse-cdn.com/julialang/original/3X/9/d/9dc4d0bbd2ecf76c4ae4b7bc28e71525d3909f31.gif)

But it has got gradually more broken over time.

There are some open issues ([Manipulate sliders hidden underneath output · Issue #196 · JuliaGizmos/Interact.jl · GitHub](https://github.com/JuliaGizmos/Interact.jl/issues/196)), ([Using Interact.jl and Luxor.jl inside IJulia (Jupyter) notebook · Issue #27 · JuliaGraphics/Luxor.jl · GitHub](https://github.com/JuliaGraphics/Luxor.jl/issues/27) which has a Help Wanted label).

And then there was InteractNext ([GitHub - JuliaGizmos/InteractNext.jl](https://github.com/JuliaGizmos/InteractNext.jl)), which also didn’t work.

It may be a problem I can fix. I don’t know…

Also, I would make sure the graphic syntax is correct, before trying to manipulate it:

```julia
julia-1.0> circle(0, 0, 5, action=:nothing)
ERROR: function circle does not accept keyword arguments

```

You want:

```julia
julia-1.0> circle(O, 5, :stroke)

```

or similar.

---

<div class="post-metadata">

**Author:** ![microlifecc](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Post date:** [November 2, 2018, 10:00pm UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079/3 "2018-11-02T22:00:01Z")

</div>

> [@cormullion](#):
>
> , :stroke

Hi cormullion! Thanks for the help.

I tried this:

```julia
@manipulate for x in 5:50
    d = Drawing(300,300,:svg)
    origin()
    sethue(Colors.RGB(0.9, 0.4,0.6))
    #circle(0, x, :stroke)
    box(0,x,x,:fill)
    finish()
    d
end

```

I am getting this error:

> MethodError: no method matching box(::Int64, ::Int64, ::Int64, ::Symbol)  
> Closest candidates are:  
> box(!Matched::Point, ::Any, ::Any, ::Symbol; vertices) at /home/subhankar/.julia/packages/Luxor/laUAE/src/shapes.jl:60  
> box(!Matched::Point, ::Any, ::Any, ::Any) at /home/subhankar/.julia/packages/Luxor/laUAE/src/shapes.jl:84  
> box(!Matched::Point, ::Any, ::Any, ::Any, !Matched::Symbol) at /home/subhankar/.julia/packages/Luxor/laUAE/src/shapes.jl:84  
> …
> 
> Stacktrace:  
> [1] (::getfield(Main, Symbol(“##11#13”)))(::Int64) at ./In[4]:6  
> [2] top-level scope at /home/subhankar/.julia/packages/InteractBase/Q4IkI/src/manipulate.jl:21  
> [3] top-level scope at In[4]:1

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 2, 2018, 10:07pm UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079/4 "2018-11-02T22:07:06Z")

</div>

the error suggests that you should use a Point. The manual describes all the available forms for `box()` [here](http://juliagraphics.github.io/Luxor.jl/latest/simplegraphics/#Rectangles-and-boxes-1). The tutorial might be worth looking at too… 🙂

---

<div class="post-metadata">

**Author:** ![nodrygo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nodrygo/32/2443_2.png) [@nodrygo](https://discourse.julialang.org/u/nodrygo)\
**Post date:** [November 3, 2018, 5:37pm UTC](https://discourse.julialang.org/t/slider-in-julia-with-luxor/17079/5 "2018-11-03T17:37:17Z")

</div>

you could try using **_Luxor_** in a **_Gtk canvas_**  
I have an old demo of a dynamic running clock here  
\_[https://github.com/nodrygo/GtkLuxorNaiveDemo\_](https://github.com/nodrygo/GtkLuxorNaiveDemo_)
