Python Forum
[matpltlib]Basic question about callback function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[matpltlib]Basic question about callback function
#4
When the slider is altered it triggers an event that calls the connected event handler with the val of the slider,
that is why the event handler function must except the val argument.
To access val in the event handler function just use the val attribute like shown below.

sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0, valstep=delta_f)
sfreq.on_changed(update)
 
def update(val):
    print(val)
 
Reply


Messages In This Thread
RE: [matpltlib]Basic question about callback function - by Yoriz - May-20-2019, 09:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Tkinter callback exception Ben123 2 582 Feb-17-2024, 06:03 PM
Last Post: deanhystad
  GUI freezes while executing a callback funtion when a button is pressed abi17124 5 7,504 Jul-10-2019, 12:48 AM
Last Post: FullOfHelp
  Unable to return value from callback function of a button in Python Tkinter nilaybnrj 4 20,840 Aug-05-2018, 11:01 PM
Last Post: woooee
  pygtk2, how to disconnect all callback of widget or window event ? harun2525 1 3,317 Feb-19-2017, 11:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020