Get the text of a button widget Get the text of a button widget tkinter tkinter

Get the text of a button widget


You can simply do:

my_text = my_button['text']

Tkinter allows you to access any option of a widget this way (height, width, text, etc.)


If you need this as a method call, you can use .cget:

my_text = my_button.cget('text')

Note that this method is available on all standard Tkinter widgets.