however python doesn’t allow me to set the ValueChanged attribute like this
the original one should be:
self.myslider.ValueChanged += self.onvaluechanged
The error is:
Runtime error (TypeErrorException): unsupported operand type(s) for +: ‘BoundEvent’ and ‘instancemethod’
Traceback:
line 25, in addnumeric, “”
line 28, in init, “”
line 45, in script
Actually, I don’t know how this line works.
The Idea is to create multiple sliders within the init function so that i don’t have to repeat myself.
Could anyone explain the idea of the line or give me some other ways to do this?
Hi @raylee14, i guess you cannot tread an Event like an attribute and assign it that way.
Below is an example, multiple sliders are added in a loop, all with the same event. Note that i Tag the sliders to detect them in the event code. I guess you can do the same with NumericStepper.
thank you so much. let me dive into this first
btw, what ValueChanged and OnValueChanged actually do?
and is there any other source to learn python eto?
I only found a few of it, make my job very very hard
ValueChanged is the event which notifies any subscriber that the value has changed.
To explain it more understandable:
A cook saying the meal is ready for instance could name this event FoodIsReady.
Any subscriber to this event can have unique response to this. Usually calling the method responsible ‚On‘- or ‚Handle‘- .
So a waiter would have a response OnFoodIsReady which does something like Go to the kitchen, grab the food bring it to the guest.
So the OnValueChanged is a individual response to the ValueChanged event.