Python:在click时更改matplotlib按钮的标签



如何更改单击matplotlib按钮的标签?就像我有一个带有标签"Before"的matplotlib按钮,我想点击它并将标签更改为"After"。我该怎么做呢?我觉得我应该知道这一点,但我真的在网上或文档中找不到任何东西。

假设这个例子http://matplotlib.org/1.3.1/examples/widgets/buttons.html

bprev.label="A new Label!" #actually this doesnt work...

我在几乎不了解按钮的情况下,通过查看文档(实际上只是瞥了一眼)http://matplotlib.org/1.3.1/api/widgets_api.html#Button

更多的实验让我想到

bprive.label.set_text("A new label") # works

最新更新