From 9a6a92ce536cf5211028026aaea7bc56f98842fe Mon Sep 17 00:00:00 2001 From: Danhickstein Date: Mon, 5 Jan 2015 17:46:40 -0700 Subject: [PATCH 1/2] including self.val to allow the user to get the current status of the radioButtons. --- lib/matplotlib/widgets.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 8c22bc899537..f55cc45f3f48 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 + + *val* + A string listing the current value selected Connect to the RadioButtons with the :meth:`on_clicked` method """ @@ -644,7 +647,6 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): The color of the button when clicked """ AxesWidget.__init__(self, ax) - self.activecolor = activecolor ax.set_xticks([]) @@ -663,6 +665,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): verticalalignment='center') if cnt == active: + self.val = label facecolor = activecolor else: facecolor = axcolor @@ -698,6 +701,7 @@ def inside(p): if t.get_window_extent().contains(event.x, event.y) or inside(p): inp = p thist = t + self.val = t.get_text() break else: return From 6ecf85207fc3028466a430a976de7d41479c85f6 Mon Sep 17 00:00:00 2001 From: Danhickstein Date: Tue, 6 Jan 2015 10:34:04 -0700 Subject: [PATCH 2/2] changed "self.val" to "self.value_selected" --- lib/matplotlib/widgets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index f55cc45f3f48..6675903b6877 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -628,7 +628,7 @@ class RadioButtons(AxesWidget): *circles* A list of :class:`matplotlib.patches.Circle` instances - *val* + *value_selected* A string listing the current value selected Connect to the RadioButtons with the :meth:`on_clicked` method @@ -648,6 +648,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): """ AxesWidget.__init__(self, ax) self.activecolor = activecolor + self.value_selected = None ax.set_xticks([]) ax.set_yticks([]) @@ -665,7 +666,7 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): verticalalignment='center') if cnt == active: - self.val = label + self.value_selected = label facecolor = activecolor else: facecolor = axcolor @@ -701,7 +702,7 @@ def inside(p): if t.get_window_extent().contains(event.x, event.y) or inside(p): inp = p thist = t - self.val = t.get_text() + self.value_selected = t.get_text() break else: return