Skip to content

Added "val" attribute to widgets.RadioButtons #3971

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
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