-1

I don't understand the output of "button.configure("text")". This function returns a tuple. what are the elements of the tuple?

from tkinter import *
from tkinter import ttk
root = Tk()


button = ttk.Button(root, text=("Hello"))
button.grid()

print(button.configure("text"))

root.mainloop()

output is:

('text', 'text', 'Text', '', 'Hello')
Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80

1 Answers1

1

From the Tcl.tk docs:

...Otherwise the list will contain five values: argvName, dbName, dbClass, defValue, and current value. The current value is computed from the appropriate field of widgRec by calling procedures like Tk_NameOfColor.

It means that tkinter returns a tuple extracted from a list of five values, which are, in sequence:

argvName, dbName, dbClass, defValue, and current value

in your case:

('text', 'text', 'Text', '', 'Hello')

argvName = 'text'  
dbName = 'text'
dbClass = 'Text'
defValue = ''
current value = 'Hello'
Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80