
The checkGrid class is an expandableFrame widget filled with textCheck widgets, along with setter and getter methods to interact with the latter by key.
checkGrid is a subclass of expandableFrame, and thus has all the methods and properties of that class as well. These are not listed here.
checkGrid is subscriptable. The value of the textCheck added with the name 'x' can be retrieved with checkGrid['x'], and toggled by setting checkGrid['x']=True or False.
Note that this is a Tkinter widget and thus will not work in other frontends like Jupyter notebooks. The recommended way to draw a custom checkGrid is with the higher-level Params.add() instead, setting the type parameter to 'checkgrid' and the opts parameter to a dict of name-label pairs.
WARNING: This is an internal class. Its use in user code is not recommended or supported, and its signature can change in future updates without warning. Use one of the suggested functions above instead, if applicable.
Initialization Parameters
parent — tkinter.Frame, optional
The Tkinter frame to which the widget should be attached.
Default value: None
text — str, optional
The title of the frame, clickable to expand and collapse.
Default value: ''
columns — int, optional
The number of columns in which to insert textCheck widgets.
Default value: 3
fg — str, optional
A hex value for the text color.
Default value: '#333'
bg — str, optional
A hex value for the background color.
Default value: '#FFF'
padx — int, optional
The container frame's horizontal padding.
Default value: 8
pady — int, optional
The container frame's vertical padding.
Default value: None
font — tuple(str,int), optional
A font name/size pair.
Default value: None
startOpen — bool, optional
If
True, the frame is drawn expanded initially. IfFalse, the frame is drawn collapsed initially.Default value: True
Methods
Click a method name for more detailed documentation.
addCheck( var, text, defaultValue, … )
Adds a
textCheckelement to the frame.disable( key )
Disables one or all
textCheck(s) attached to the frame.disabled( key, val )
Enables or disables a textCheck.
enable( key )
Enables one or all
textCheck(s) attached to the frame.items( )
Returns a list of tuples corresponding to key-value pairs of the added
textCheckobjects, by analogy todict.items().keys( )
Returns a list of names of registered checks, by analogy to
dict.keys().toggle( )
Expands a collapsed frame, and collapses an expanded frame.
Note that the function signature takes one optional argument, a Tkinter event string, in order to be used as a callback for a click event. This argument is not used in the function.
values( )
Returns a list of
textCheckitems, by analogy todict.values().
Object Properties
padx — int
The container frame's horizontal padding.
pady — int
The container frame's vertical padding.
text — str
The title of the expandable frame.
titleLabel — tkinter.Label
The Tkinter
Labelelement corresponding to the clickable title.open — tkinter.IntVar
Whether the frame is expanded or collapsed. Setting this parameter will also open and close the frame.
Initial value: bool
subframe — tkinter.Frame
The Tkinter
Frameelement that gets expanded and collapsed. Can be interacted with and have elements placed into it like anyFrameelement.Initial value:
columns — int
The number of columns in which to insert textCheck widgets.
Initial value: 3
checks — dict{str:textCheck}
The textCheck widgets to be displayed.
Initial value: {}
charwick
Mar 27, 2020 at 21:34Checkgrids can be inserted using GUI hooks where there are lots of values to toggle. This example toggles strategies and puts the
checkGridobject inmodel.strategiesfor the values to be retrieved later.This results in the following panel: