Err that is slider[:on_changed]( #WHERE I WANT THE MACRO TO GO variable = slider.val )
On Friday, March 25, 2016 at 10:57:34 AM UTC-7, Lewis Lehe wrote: > > Hi, > I am learning about metaprogramming and macros. I have a very basic case > but am unsure about what Julia is capable of. last time I asked a question > here I got a very helpful answer shortly. > > I am making sliders for a matplotlib plot. I would that when a slider > changes, it changes some the value of some variable. Here is an example. > > frequency = 2.0 > function makeSlider(axSlider, variable): > slider = widget.Slider(axSlider; valinit=variable) > slider.on_changed( > #WHERE I WANT THE MACRO TO GO > variable = slider.val > ) > slider > end > freqSlider = makeSlider(axFrequency,frequency) > > > Is this possible? I did not see any use cases like this in the > documentation. > > I would normally do it by keeping all my constants as properties of some > World type (or in some world Dictionary) and passing the key to the > function, but I wanted to learn how to use this part of Julia. > > Thanks! >
