A combination checkbox/textbox GUI element that returns False when the checkbox is unchecked, and the value of the textbox when the checkbox is checked.
This class inherits from tkinter.Frame
and will contain all the methods and properties of that class as well. These are not listed here.
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 checkEntry is with the higher-level Params.add()
instead, setting the type
parameter to 'checkentry'
.
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 element should be attached.
Default value: None
title — str, optional
The label for the element.
Default value: None
width — int, optional
The width of the textbox.
Default value: 20
bg — str, optional
The background color of the element.
Default value: '#FFFFFF'
font — tuple(str,int), optional
A font name/size pair.
Default value: ('Lucida Grande',12)
default — bool|str|int, optional
The initial value of the check entry.
Default value: ''
datatype — str, optional
Can be set to
'int'
to limit the textbox to numeric input.Default value: 'string'
command — func(val), optional
A callback function that takes one argument, the value of the checkEntry.
Default value: None
Methods
Click a method name for more detailed documentation.
disable( )
Disables the
checkEntry
element so it cannot be interacted with by the user.disabled( disable )
Enables or disables the
checkEntry
element. This function is aliased by bothcheckEntry.enable()
andcheckEntry.disable()
.enable( )
Enables the
checkEntry
element so it can be interacted with by the user.get( )
Retrieves the value of the combined
checkEntry
element:False
if the checkbox is unchecked, and the value of the textbox otherwise.set( value )
Sets the value of the
checkEntry
element. Pass abool
to activate or deactivate the checkbox, and pass astr
orint
to change the value of the textbox.-
Updates the enabled state of the text field to correspond to the value of the checkbox.
Object Properties
enabled — bool
Whether or not the user can currently interact with the element.
Initial value: True
entryValue — tkinter.StringVar
The value of the textbox, regardless of the state of the checkbox. Use
checkEntry.entryValue.get()
to get a string value.textbox — tkinter.Entry|tkinter.Spinbox
The textbox element, an
Entry
iftype=='string'
orSpinbox
iftype=='int'
.checkVar — tkinter.BooleanVar
The value of the checkbox. Use
checkEntry.checkVar.get()
to get a boolean value.checkbox — tkinter.Checkbutton
The checkbox element.
callback — func(val)
The callback function entered in the
command
argument.
Notes and Examples