diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 8c22bc899537..6675903b6877 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -627,6 +627,9 @@ class RadioButtons(AxesWidget): *circles* A list of :class:`matplotlib.patches.Circle` instances + + *value_selected* + A string listing the current value selected Connect to the RadioButtons with the :meth:`on_clicked` method """ @@ -644,8 +647,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): The color of the button when clicked """ AxesWidget.__init__(self, ax) - self.activecolor = activecolor + self.value_selected = None ax.set_xticks([]) ax.set_yticks([]) @@ -663,6 +666,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): verticalalignment='center') if cnt == active: + self.value_selected = label facecolor = activecolor else: facecolor = axcolor @@ -698,6 +702,7 @@ def inside(p): if t.get_window_extent().contains(event.x, event.y) or inside(p): inp = p thist = t + self.value_selected = t.get_text() break else: return