[PYTHON] Color list that can be set with tkinter (memorial)

Trigger

I'm writing a little application in Python.

I adopted tkinter for the UI and proceeded with the implementation, but the design is only reminiscent of Windows applications (such as VB) 20 years ago. .. ..

So I thought at least I wanted to make the colors look good, but I can't use RGB! ?? It seems that there is a constant for the color scheme peculiar to Tkinter. .. ..

Reference site 1

I searched the list and hit this page: https://www.tcl.tk/man/tcl8.4/TkCmd/colors.htm

It is listed on a text basis, but it is very difficult to understand. Yes, let's make it easier to see!

List of constants and colors

I made it possible to check the color using Excel VBA. The result is an image, so for your reference.

https://www.zero-one-system.co.jp/wp-content/uploads/2020/06/tkinter_colors.png

tkinter_colors2.jpg

Reference site 2

As a result of various searches, after finishing making the above image, I found the following site: https://stackoverflow.com/questions/4969543/colour-chart-for-tkinter-and-tix

If you run the Python code, you can see everything.

About Excel VBA

It's a complete bonus, but I'll put it here.

tkinter_colors.jpg

VBA code:

GenerateColor.xlsm




Private Sub CommandButton1_Click()
    'Variable definition
    Dim n_row_st As Integer
    Dim n_col_nm As Integer
    Dim n_col_r As Integer
    Dim n_col_g As Integer
    Dim n_col_b As Integer
    
    Dim n_col_bg As Integer
    
    Dim i, n, m As Integer
    
    'Variable setting
    n_row_st = 5
    n_col_nm = 2
    n_col_r = 3
    n_col_g = 4
    n_col_b = 5
    n_col_bg = 7
    
    'Get background color from RGB and set
    i = 0
    Do Until Cells(n_row_st + i, n_col_nm).Value = ""
        Cells(n_row_st + i, n_col_bg).Interior.Color = _
            RGB(Cells(n_row_st + i, n_col_r).Value _
               , Cells(n_row_st + i, n_col_g).Value _
               , Cells(n_row_st + i, n_col_b).Value)
        i = i + 1
    Loop
    
    'the end
    Call MsgBox("OK")
    
End Sub


If anyone wants such VBA, please let us know in the comments. I will upload it somewhere.

Recommended Posts

Color list that can be set with tkinter (memorial)
List packages that can be updated with pip
Make a Spinbox that can be displayed in Binary with Tkinter
Make a Spinbox that can be displayed in HEX with Tkinter
File types that can be used with Go
Get a list of camera parameters that can be set with cv2.VideoCapture and make it a dictionary type
Python knowledge notes that can be used with AtCoder
Limits that can be analyzed at once with MeCab
List the classes that can be referenced by ObjCClass
Format summary of formats that can be serialized with gensim
It seems that Skeleton Tracking can be done with RealSense
I investigated the pretreatment that can be done with PyCaret
Let's make a diagram that can be clicked with IPython
[Python] Make a graph that can be moved around with Plotly
requirements.txt can be commented out with #
I made a shuffle that can be reset (reverted) with Python
Confirmation that rkhunter can be installed
Make a currency chart that can be moved around with Plotly (2)
Comparison of 4 styles that can be passed to seaborn with set_context
Make a currency chart that can be moved around with Plotly (1)
EXCEL data bar and color scale can also be done with pandas
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Application]
Create a web app that can be easily visualized with Plotly Dash
Mathematical optimization that can be used for free work with Python + PuLP
Draw a graph that can be moved around with HoloViews and Bokeh
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Basic]
Set the xticklabels color individually with matplotlib
Items that cannot be imported with sklearn
[Python] Creating a tool that can list, select, and execute python files with tkinter & about the part that got caught
A memo for making a figure that can be posted to a journal with matplotlib
Moved Raspberry Pi remotely so that it can be LED attached with Python
Format DataFrame data with Pytorch into a form that can be trained with NN
I made a familiar function that can be used in statistics with Python
List of tools that can be used to easily try sentiment analysis of Japanese sentences in Python (try with google colab)
Until youtube-dl can be used with Synology (DS120j)
Functions that can be used in for statements
Building Sphinx that can be written in Markdown
Convert images from FlyCapture SDK to a form that can be used with openCV
Set up an FTP server that can be created and destroyed immediately (in Python)
[Python] Introduction to web scraping | Summary of methods that can be used with webdriver
Morphological analysis and tfidf (with test code) that can be done in about 1 minute
File sharing server made with Raspberry Pi that can be used for remote work
The story that sendmail that can be executed in the terminal did not work with cron