tkinter.Checkbutton.pack


Definition
The syntax configure the Checkbutton.

Syntax
tkinter.Checkbutton.pack()
Checkbutton.pack()

Options
  • Checkbutton(
  • after=widget - pack it after you have packed widget
  • anchor=NSEW (or subset) - position widget according to given direction
  • before=widget - pack it before you will pack widget
  • expand=bool - expand widget if parent size grows
  • fill=NONE or X or Y or BOTH - fill widget if widget grows
  • in=master - use master to contain this widget
  • in_=master - see 'in' option description
  • ipadx=amount - add internal padding in x direction
  • ipady=amount - add internal padding in y direction
  • padx=amount - add padding in x direction
  • pady=amount - add padding in y direction
  • side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.
  • )
Example
The code returns with the Checkbox().
from tkinter import*
master=Tk()

checkbutton1=Checkbutton(master,text="C1")
checkbutton1.pack(side=LEFT)

checkbutton2=Checkbutton(master, text="C2")
checkbutton2.pack(side=RIGHT)

checkbutton3=Checkbutton(master,text="C3")
checkbutton3.pack(side=TOP)

checkbutton4=Checkbutton(master,text="C4")
checkbutton4.pack(side=BOTTOM)

master.mainloop()





The Checkbutton is placed inside the LabelFrame.
 from tkinter import*
master=Tk()

labelframe=LabelFrame(master, text="Your age")
labelframe.pack(side=LEFT)

checkbutton1=Checkbutton(labelframe, text=" 16+")
checkbutton1.pack()

checkbutton2=Checkbutton(labelframe, text=" 30+")
checkbutton2.pack()

checkbutton3=Checkbutton(labelframe, text=" 40+")
checkbutton3.pack()

checkbutton3=Checkbutton(labelframe, text=" 60+")
checkbutton3.pack()

master.mainloop()





Comments