# Javis get\_position doesn't work

**URL:** <https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723>\
**Category:** General Usage\
**Tags:** javis\
**Created:** [September 23, 2022, 8:44pm UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723 "2022-09-23T20:44:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feed\_Back](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feed_back/32/42917_2.png) [@Feed\_Back](https://discourse.julialang.org/u/Feed_Back)\
**Post date:** [September 23, 2022, 8:44pm UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/1 "2022-09-23T20:44:07Z")

</div>

if i type:

```julia
triangle = Object( JPoly(ngon(vertices_square[1], 10, 3, -π / 2, vertices = true); action = :fill, color = "black")))

```

and use this object inside some functions, ill get this error:( using pos(triangle) )

> ERROR: MethodError: no method matching get\_position(::Vector{Point})  
> Closest candidates are:  
> get\_position(::Javis.Layer) at C:\Users\lol.julia\packages\Javis\UaLm7\src\layers.jl:187  
> get\_position(::Point) at C:\Users\lol.julia\packages\Javis\UaLm7\src\object\_values.jl:17  
> get\_position(::Transformation) at C:\Users\lol.julia\packages\Javis\UaLm7\src\object\_values.jl:18  
> …  
> Stacktrace:  
> [1] get\_position(obj::Object)  
> @ Javis C:\Users\lol.julia\packages\Javis\UaLm7\src\object\_values.jl:32

Insted if i use:

```julia
JCircle(vertices_square[1], 3; action = :fill, color = "black")

```

all my program works fine.  
how can i fix this?

---

<div class="post-metadata">

**Author:** ![arbitrandomuser](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arbitrandomuser/32/19374_2.png) [@arbitrandomuser](https://discourse.julialang.org/u/arbitrandomuser)\
**Post date:** [September 24, 2022, 6:33am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/2 "2022-09-24T06:33:41Z")

</div>

the workaround i can suggest for now is to explicitly declare an object calling `poly` in the object function instead of using the shorthand

```julia
triangle = Object ( frames , (args...) -> begin
                                              sethue("black")
                                              poly(ngon(vertices_...) , :fill)
                                              O
                                          end )
                                        

```

---

<div class="post-metadata">

**Author:** ![Feed\_Back](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feed_back/32/42917_2.png) [@Feed\_Back](https://discourse.julialang.org/u/Feed_Back)\
**Post date:** [September 24, 2022, 9:18am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/3 "2022-09-24T09:18:06Z")

</div>

thx for the reply  
i have another type of error now:

> ERROR: MethodError: no method matching (::var"#17#18")(::Video, ::Object, ::Int64; center=Point(-199.91949180758272, -199.00324605295305))  
> Closest candidates are:  
> (::var"#17#18")(::Any…) at c:\Users\lol\Desktop\julia\_esercizi\testants\graph.jl:181 got unsupported keyword argument “center”  
> Stacktrace:  
> [1] draw\_object(object::Object, video::Video, frame::Int64, origin\_matrix::Matrix{Float64}, layer\_frames::Nothing)  
> @ Javis C:\Users\lol.julia\packages\Javis\UaLm7\src\Javis.jl:666

its’ because i am using

```julia
obj.change_keywords[:center] = new_point

```

to change the positions of objects without using transition.  
it seems that i must use another keyword for the dictionary change\_keywords when i declare explicitly the object

---

<div class="post-metadata">

**Author:** ![arbitrandomuser](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arbitrandomuser/32/19374_2.png) [@arbitrandomuser](https://discourse.julialang.org/u/arbitrandomuser)\
**Post date:** [September 24, 2022, 9:22am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/4 "2022-09-24T09:22:29Z")

</div>

can you post the code here ?

---

<div class="post-metadata">

**Author:** ![Feed\_Back](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feed_back/32/42917_2.png) [@Feed\_Back](https://discourse.julialang.org/u/Feed_Back)\
**Post date:** [September 24, 2022, 9:29am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/5 "2022-09-24T09:29:00Z")

</div>

> **[Javis.jl examples series: The chase problem](https://opensourc.es/blog/javis.jl-examples-series-the-chase-problem/)**
>
> Animating a simple problem in Javis. Exploring different ways of animating in the newer versions of Javis

this is an example of using change\_keywords  
i use it in the same way, here too if you change the code and declare explicitly the obj you will have the same error

---

<div class="post-metadata">

**Author:** ![arbitrandomuser](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arbitrandomuser/32/19374_2.png) [@arbitrandomuser](https://discourse.julialang.org/u/arbitrandomuser)\
**Post date:** [September 24, 2022, 10:07am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/6 "2022-09-24T10:07:24Z")

</div>

the shorthands construct an anonymous function for you , take a look at `JCircle.jl` in the source ,  
it returns an anonymous function which has the signature `(args...; center , radius , color , linewidth ,action )` so in that example the obj.func has a kwarg `center`.

If you want to declare explicitly and not use shorthands you have to ensure that the function passed inside `Object` has a kwarg `center` (it **should** be a kwarg , not a usual arg)

similarly in your example , the function used for drawing should have a kwarg called `center`

---

<div class="post-metadata">

**Author:** ![Feed\_Back](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feed_back/32/42917_2.png) [@Feed\_Back](https://discourse.julialang.org/u/Feed_Back)\
**Post date:** [September 24, 2022, 10:37am UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/7 "2022-09-24T10:37:48Z")

</div>

Fantastic! i read carefully **JCircle.jl** and tried to do the same thing with my anonymous function.  
the solution is this:

```julia
Object(1:nframes,(args...;center =Point(10,30) -> begin
    obj_coordinate = center

    radius = 5
    ....

return obj_coordinate
                                              end ))

```

should i make your comment as the solution or mine? i m still learning on how to help the comunity

---

<div class="post-metadata">

**Author:** ![arbitrandomuser](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arbitrandomuser/32/19374_2.png) [@arbitrandomuser](https://discourse.julialang.org/u/arbitrandomuser)\
**Post date:** [September 24, 2022, 2:42pm UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723/8 "2022-09-24T14:42:35Z")

</div>

you can mark whichever , upto you 😅,

Also I’m not sure on the etiquette on having a follow up question in the comments or as a separate  
post altogether .

Also maybe change the code to be in a code block , (looks nicer that way 😅 )
