MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / CheckButtons

Class CheckButtons

lib/matplotlib/widgets.py:1233–1489  ·  view source on GitHub ↗

r""" A GUI neutral set of check buttons. For the check buttons to remain responsive you must keep a reference to this object. Connect to the CheckButtons with the `~._Buttons.on_clicked` method. Attributes ---------- ax : `~matplotlib.axes.Axes` The parent Axes

Source from the content-addressed store, hash-verified

1231
1232
1233class CheckButtons(_Buttons):
1234 r"""
1235 A GUI neutral set of check buttons.
1236
1237 For the check buttons to remain responsive you must keep a
1238 reference to this object.
1239
1240 Connect to the CheckButtons with the `~._Buttons.on_clicked` method.
1241
1242 Attributes
1243 ----------
1244 ax : `~matplotlib.axes.Axes`
1245 The parent Axes for the widget.
1246 labels : list of `~matplotlib.text.Text`
1247 The text label objects of the check buttons.
1248 """
1249
1250 def __init__(self, ax, labels, actives=None, *, layout=None, useblit=True,
1251 label_props=None, frame_props=None, check_props=None):
1252 """
1253 Add check buttons to `~.axes.Axes` instance *ax*.
1254
1255 Parameters
1256 ----------
1257 ax : `~matplotlib.axes.Axes`
1258 The parent Axes for the widget.
1259 labels : list of str
1260 The labels of the check buttons.
1261 actives : list of bool, optional
1262 The initial check states of the buttons. The list must have the
1263 same length as *labels*. If not given, all buttons are unchecked.
1264 layout : None or "vertical" or "horizontal" or (int, int), default: None
1265 The layout of the check buttons. Options are:
1266
1267 - ``None``: Use legacy vertical layout (default).
1268 - ``"vertical"``: Arrange buttons in a single column with
1269 dynamic positioning based on text widths.
1270 - ``"horizontal"``: Arrange buttons in a single row with
1271 dynamic positioning based on text widths.
1272 - ``(rows, cols)`` tuple: Arrange buttons in a grid with the
1273 specified number of rows and columns. Buttons are placed
1274 left-to-right, top-to-bottom with dynamic positioning.
1275
1276 The layout options "vertical", "horizontal" and ``(rows, cols)``
1277 create ``mtext.Text`` objects to determine exact text sizes, and
1278 then they are added to the Axes. This is usually okay, but may cause
1279 side-effects and has a slight performance impact. Therefore the
1280 default ``None`` value avoids this.
1281
1282 .. admonition:: Provisional
1283 The new layout options are provisional. Their algorithmic
1284 behavior, including the exact positions of buttons and labels,
1285 may still change without prior warning.
1286
1287 .. versionadded:: 3.11
1288 useblit : bool, default: True
1289 Use blitting for faster drawing if supported by the backend.
1290 See the tutorial :ref:`blitting` for details.

Callers 2

check_buttons.pyFile · 0.90

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…