【发布时间】:2015-04-29 18:47:07
【问题描述】:
在按钮按下的回调函数中,除了'event'之外,还有没有传递更多的参数?例如,在回调函数中,我想知道按钮的文本(本例中为“下一步”)。我该怎么做?
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
fig = plt.figure()
def next(event):
# I want to print the text label of the button here, which is 'Next'
pass
axnext = plt.axes([0.81, 0.05, 0.1, 0.075])
bnext = Button(axnext, 'Next')
bnext.on_clicked(next)
plt.show()
【问题讨论】:
标签: python button matplotlib callback