Python Forum
Tkinter parameter question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter parameter question

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 :-)

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 capitalized
all constants can be found at

colors on the other hand are used across many packages including tkinter. The 'standard' is to use CamelCase see: 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:
OK, clear !


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] question for a tkinter dialog box RobertAlvarez424 2 576 Aug-25-2021, 03:08 PM
Last Post: RobertAlvarez424
  Python tkinter question tablet Nick_tkinter 8 1,982 Mar-04-2021, 10:44 PM
Last Post: Larz60+
  tkinter slider question Nick_tkinter 1 893 Feb-22-2021, 01:31 PM
Last Post: deanhystad
  [Tkinter] Noob question:Using pyttsx3 with tkinter causes program to stop and close, any ideas? Osman_P 4 2,753 Nov-14-2020, 10:51 AM
Last Post: Osman_P
  question on tkinter canvas PhotoImage gr3yali3n 1 974 Sep-05-2020, 12:18 PM
Last Post: Larz60+
  What units does the width parameter of a tkinter Listbox use? Pedroski55 2 1,497 Jul-04-2020, 08:17 AM
Last Post: deanhystad
  Newbie question with Tkinter Entry mariolopes 2 1,245 Oct-12-2019, 11:02 PM
Last Post: Larz60+
  tkinter filedialog and pickle - custom icon question. kim07133 0 1,785 Jan-08-2018, 12:10 PM
Last Post: kim07133

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020