Nictk 2.2.0
An easy to use pyton GUI
Checkbutton Class Reference

Checkbutton widget which is either in on or off state. More...

Inheritance diagram for Checkbutton:
Widget Misc

Public Member Functions

def __init__ (self, parent, x, y, w, h, pad=0, content="", variable=None, command=None)
 The constructor. More...
 
def get_value (self)
 Returns the actual value associated to the button state. More...
 
def set_value (self)
 Changes the actual value associated to the button state and updates the widget. More...
 
def set_variable (self, variable=None, offvalue=None, onvalue=None)
 Sets the associated tkinter.Variable object and its values when the button is in off and on state. More...
 
- Public Member Functions inherited from Widget
def activate (self)
 Sets the state of the widget to NORMAL. More...
 
def deactivate (self)
 Sets the state of the widget to DISABLED. More...
 
def destroy (self)
 Overrides the BaseWidget method, unmapping the widget if its parent is a _embedVerFrame. More...
 
def enabled (self)
 Returns True if the widget is enabled. More...
 
def get_content (self)
 Returns the content of the widget as a string. More...
 
def hide (self)
 Hides the widget. More...
 
def init_content (self, content)
 Sets the content type for the widget. More...
 
def resize (self, x=None, y=None, w=None, h=None, pad=None)
 Changes the dimensions of the widget. More...
 
def set_content (self, content)
 Sets the content of the widget. More...
 
def show (self)
 Shows a previously hidden widget. More...
 
def visible (self)
 Returns True if the widget is visible. More...
 
- Public Member Functions inherited from Misc
def bind (self, sequence=None, func=None, add=None)
 Redefines the tk.Misc.bind() method. More...
 
def config (self, cnf=None, **kw)
 Configures resources of a widget. More...
 
def get_config (self, key)
 Returns the value for the key resource. More...
 
def get_winfo (self, key)
 Returns the widget info for the item key. More...
 
def has_option (self, opt=None)
 Returns True if the widget admits the given option. More...
 
def parent (self)
 Returns the widget parent. More...
 
def toplevel (self)
 Returns the widget toplevel container (a Window or Main). More...
 
def unbind (self, sequence, funcid=None)
 Redefines the tk.Misc.unbind() method. More...
 
def winfo_bh (self)
 Returns the height of the widget bounding box. More...
 
def winfo_bpad (self)
 Returns the list of the four pad amounts (E-N-W-S) of the widget with respect to its bounding box. More...
 
def winfo_bw (self)
 Returns the width of the widget bounding box. More...
 
def winfo_bx (self)
 Returns the x coordinate of the widget bounding box topleft corner. More...
 
def winfo_by (self)
 Returns the y coordinate of the widget bounding box topleft corner. More...
 
def winfo_height (self)
 Returns the widget height. More...
 
def winfo_width (self)
 Returns the widget width. More...
 
def winfo_x (self)
 Returns the x coordinate of the topleft corner of the widget with respect to the parent. More...
 
def winfo_y (self)
 Returns the y coordinate of the topleft corner of the widget with respect to the parent. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Misc
def winfo_h = winfo_height
 Alias for winfo_height() More...
 
def winfo_w = winfo_width
 Alias for winfo_width() More...
 

Detailed Description

Checkbutton widget which is either in on or off state.

You can associate a variable to its states and a callback to be called when the state of the button changes.

Common options (see Widgets properties)

  abcolor, afcolor, anchor, bcolor, borderwidth, command, cursor,
  dfcolor, font, fcolor, hbcolor, hborder, hfcolor, justify, relief,
  scolor, state, takefocus, text, textvariable, variable, wraplength   

Less common options

  bitmap, image, indicatoron, offvalue, onvalue, padx, pady,
  selectimage, underline

see anzeljg reference for the class tkinter.Checkbutton.

See also
RCbuttons.py example file

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  parent,
  x,
  y,
  w,
  h,
  pad = 0,
  content = "",
  variable = None,
  command = None 
)

The constructor.

You can specify here the label of the button, a Variable object which will be updated at state change and a callback to associate to status change.

Parameters
parentthe widget parent
x,y,w,h,padsee Placing the widgets
contentthe button label; here you can specify
  • a string
  • a StringVar (which automatically updates the button label when changed)
  • a tkinter.BitmapImage or tkinter.PhotoImage objects
variablethe Variable object whose value is associated with the button states; here you can specify:
  • None: an IntVar is automatically created and values 0 and 1 associated; you can get the button status with the get_value() method
  • a Variable object which will get the values 1 (or "1" if StringVar) for on and 0 ("0") for off
  • a triple (variable, onvalue, offvalue) specifying the variable, its value for on and its value for off
commandsee Events and callbacks

Reimplemented from Widget.

Member Function Documentation

◆ get_value()

def get_value (   self)

Returns the actual value associated to the button state.

Note
for this class the get_content() method returns the button label, NOT the button status value

◆ set_value()

def set_value (   self)

Changes the actual value associated to the button state and updates the widget.

Note
for this class the get_content() method returns the button label, NOT the button status value

◆ set_variable()

def set_variable (   self,
  variable = None,
  offvalue = None,
  onvalue = None 
)

Sets the associated tkinter.Variable object and its values when the button is in off and on state.

Only the given values are changed. You should do this in the constructor so you need this only if you want to change them later.


The documentation for this class was generated from the following file: