According to the docs it is a legitim way to configure your widgets.
The reason why this works is because of the mapping protocol that is used by tkinter. As an example you can see here how it works and there is no danger in usage of it:
class Unpackable(object):
def __init__(self):
self.options=['hello','world']
def keys(self):
return self.options
def __getitem__(self, key):
return dict(zip(self.options,'first_word last_word'.split()))[key]
unp = Unpackable()
print(unp['hello'])
Output:
first_word
The offical python documentation says to setting options:
Options control things like the color and border width of a widget.
Options can be set in three ways:
At object creation time, using keyword arguments
fred = Button(self, fg="red", bg="blue")
After object creation, treating the option name like a dictionary
index
fred["fg"] = "red"
fred["bg"] = "blue"
Use the config() method to update multiple attrs subsequent to object
creation
fred.config(fg="red", bg="blue")