Sunday, September 6, 2020

Python Tkinter Colors



Hello dear readers! welcome back to another section of our tutorial on Python. In this tutorial post, we are going to be discussing about Python Tkinter Colors.

Python Tkinter represents colors with strings. There are two common ways to specify colors in Tkinter -

  • You can make use of a string specifying the proportion of the colors; red, green and blue in hexadecimal digits. E.g, the hexadecimal digits "#000fff000" is green, "#fff" is white, "#000000" is black, and "#444444" is grey.
  • A well defined standard color names can also be used. The colors "white", "black", "green", "red", "blue", "yellow", "cyan" and "magenta" will always be available.


Legnth Options

Following is the list of common color options

  • activebackground - The background color for the widget when the widget is active.
  • activeforeground - The foreground color for the widget when the widget is active.
  • background - This is the background color of the widget. This can also be represented as bg.
  • disabledforeground - The Foreground color of the widget when the widget is disabled.
  • foreground - The foreground color of the widget. This can be represented as fg.
  • highlightbackground - The Background color of the height region when the widget has focus.
  • highlightcolor - Foreground color of the highlight region when the widget has focus.
  • selectbackground - The background color for the selected items of the widget.
  • selectforeground - The Foreground color of the selected items of the widget.


Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the Python Tkinter Fonts.

Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.
Share:

0 comments:

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.