|
From: Benjamin R. <ben...@ou...> - 2014-12-17 19:14:24
|
the reset() method is meant to return the slider back to its initialized value, that's it. I suspect what you are having difficulties with has to do with your use of a global variable "amp". It is going to be completely unlikely that updates to the slider's "val" attribute would actually be updating the global variable rather than simply replacing it with a new variable. What are you trying to do? Ben Root On Wed, Dec 17, 2014 at 2:01 PM, peterfR <pe...@pe...> wrote: > > [This post might appear twice, if so, I apologize. The first version is > flagged that it has not been accepted yet] > > I am controlling a simple animation with a slider, successfully. A mouse > drag updates the parameter correctly but the slider-bar position is not > updated. > > If "samp" is a slider, the code > "samp.reset(amp)" generates > "TypeError: reset() takes exactly 1 argument (2 given)". > > Here is more detail of the code: > > ===== > samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=amp) > > def update(val): > global amp > amp = samp.val > # samp.reset() # if this is included, a mouse-drag does not change > value of amp. No error. > # samp.reset(amp) # if this is included, a mouse-drag changes value of > amp, but the > # slider-bar-position is not updated. The animation > continues to run in both cases. > # AND GET ERROR: > *********** > File "SAS_asl.py", line 28, in update > samp.reset(amp) # > > TypeError: reset() takes exactly 1 argument (2 given) > *********** > > > # If there is no call to reset in “update” and the following function is > included: > > def reset(event): > samp.reset() # amp is changed, slider-bar-position is not updated > and NO ERROR IS GENERATED > > > samp.on_changed(update) # always present! > > This appears to be a bug. If not, what is wrong with the code? > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Possible-bug-in-slider-reset-tp44638.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |