VOOZH about

URL: https://www.geeksforgeeks.org/python/python-how-to-dynamically-change-text-of-checkbutton/

⇱ Python | How to dynamically change text of Checkbutton - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python | How to dynamically change text of Checkbutton

Last Updated : 11 Jul, 2025
Tkinter is a GUI (Graphical User interface) module which is used to create various types of applications. It comes along with the Python and consists of various types of widgets which can be used to make GUI more attractive and user-friendly. Checkbutton is one of the widgets which is used to select multiple options. Checkbutton can be created as follows:
chkbtn = ttk.Checkbutton(parent, value = options, ...)
Code #1: Output #1: When you run application you see the initial states of Checkbutton as shown in output. 👁 Image
Output #2: As soon as you select the Checkbutton you'll see that text has been changed as in output. 👁 Image
Output #3: When you deselect the Checkbutton you'll again observe following changes. 👁 Image
Code #2: Commands can be integrate with the Checkbutton which can be execute when checkbutton is selected or deselected depending upon conditions.
Output: 👁 Image
Note: In above code offvalue and onvalue are used to set the values of Checkbutton of non-selected state and selected state respectively.
Comment
Article Tags: