Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "val" attribute to widgets.RadioButtons #3971

Merged
merged 2 commits into from Jan 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/matplotlib/widgets.py
Expand Up @@ -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
"""
Expand All @@ -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([])
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down