It'd be awesome if I could get something like the below.
Pseudo Code:
U = widget1.SettingsGet()
Print U
Upon printing U something like this would be returned:
widget1(background='green',foreground='grey',boarderwidth=10, relief='flat')
It would be really useful to be able to get a widgets settings. So that I can manipulate other widgets accordingly.
If you know what settings you need, you can just use the
cget
method to get values e.g.It will print
If you want to know all the available options, widget.config contains the config and from that if you wish you can create all or a subset of settings which you may need e.g.
Output:
To get all attributes of a widget from cget, you can use keys() to get the attributes and then cget to get the value of those atributes. IE:
This code returns:
That was a lot of spaces >.<
In this block the first is the key and the second is the value of said key. The keys method (for all widgets) returns all of the keys in said widget. Config returns the keys and what they apply to (cursor vs Cursor) where keys just gives a list of all attributes.