Tkinter parameter question - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Tkinter parameter question (/thread-24994.html) |
Tkinter parameter question - DPaul - Mar-14-2020 Hi, I am a self-taught Tkinter user and, thank you, all is going well. But I have a question in the realm of widget parameters. Why is it that sometimes you have to write : (...., bg = 'orange', ...) and somewhere else : (.... , state = DISABLED, ...) Why not : ... state = 'disabled' ... There are other examples. It would be more consistent, although i suspect that the Tkinter folk had good reasons. I would like to know them :-) thx, Paul RE: Tkinter parameter question - Larz60+ - Mar-14-2020 tkinter.DISABLED is a constant defined in the tkinter package whose value is 'disabled', so you could use state='disabled' and it would work the same. However, the naming convention in python for constants is Quote:Constant names must be fully capitalizedall constants can be found at https://github.com/python/cpython/tree/master/Lib/tkinter/constants.py colors on the other hand are used across many packages including tkinter. The 'standard' is to use CamelCase see: https://www.w3schools.com/colors/colors_names.asp however case is not strictly adhered to in all applications, therefore even though 'Orange' is 'standard' 'orange' will usually work. pynche is the python color and hue editor defines all colors in a text file if you want a list, they can be found here: https://github.com/python/cpython/blob/master/Tools/pynche/namedcolors.txt RE: Tkinter parameter question - DPaul - Mar-14-2020 OK, clear ! thx, Paul |