-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
executable file
·67 lines (65 loc) · 5.08 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<meta charset="utf-8">
<!--markdown .md to HTML conversion courtesy of https://markdowntohtml.com/ -->
<html lang="en">
<h1 id="tkinter_utilities">tkinter_utilities</h1>
<h2 id="tk-color_widget-helper">tk_color_helper</h2>
<p><img src="images/helper_icon256.png" alt="tkinter-colors"></p>
<p>A Python utility to help choose colors and their color_widget blind equivalents
for tkinter GUIs. Draws an interactive color_widget table for 760 color_widget names
found in X11 rgb.txt that are recognized by tkinter 8.6. Works with
Linux, Windows, and MacOS.
Usage: Click on a color_widget name to show its hex code and RGB
value and display that color_widget as background. Right-click a different color_widget
to change the text foreground. Clicking on another color_widget will retain
that selected foreground. Click with a key modifier to show the
color_widget blind simulation of the selected color_widget: Shift = deuteranopia,
Ctrl = protanopia, Alt(Command) = tritanopia, Shift-Ctrl = grayscale;
the foreground color_widget will automatically match the simulation
type. Simulated color_widget hex codes and RGB values may not correspond to any
named color_widget, but the hex string will be recognized by tkinter.
Using the Ctrl key (or Command in macOS) while pressing D, P, T, or
G will pop-up a non-interactive color_widget table simulated for deuteranopia,
protanopia, tritanopia, or grayscale, respectively.
Text in the color_widget display and data fields can be cut, copied, pasted,
or edited with standard keyboard and click commands. Runs with Python 3.6
and tkinter 8.6 or later.
Color table construction based on code from
<a href="https://stackoverflow.com/questions/4969543/colour-chart-for-tkinter-and-tix">https://stackoverflow.com/questions/4969543/colour-chart-for-tkinter-and-tix</a></p>
<p>From the green Code button above, download and unzip the ZIP file. From within the resulting tkinter_utilities-main folder, open a Terminal or Command Prompt.</p>
<h3 id="usage-">Usage:</h3>
<p>From within the program's folder, use one of these Terminal or Command Prompt commands, depending on your system:</p>
<pre><code> <span class="hljs-keyword">python3</span> -<span class="hljs-keyword">m</span> tk_color_helper (recommended <span class="hljs-keyword">for</span> <span class="hljs-keyword">all</span> systems)
<span class="hljs-keyword">py</span> tk_color_helper.<span class="hljs-keyword">py</span> (Windows)
<span class="hljs-keyword">python3</span> tk_color_helper.<span class="hljs-keyword">py</span> (Linux, Mac)
./tk_color_helper.<span class="hljs-keyword">py</span> (Linux, Mac)
</code></pre><p>Command line arguments <code>--help</code> and <code>--about</code> are available, e.g.,</p>
<pre><code>$ python3 -m tk_color_helper --help
usage: tk_color_helper.py [-h] [--about]
optional arguments:
-h, --help show this help message and <span class="hljs-keyword">exit</span>
--about Provide description, version, GNU license
</code></pre><p>Table at startup:
<img src="images/full_color_start.png" alt="tkinter-colors"></p>
<p>Example usage: Click on LightSeaGreen to select a background...
<img src="images/select-bg.png" alt="select-background"></p>
<p>...next, right-click MediumVioletRed to change the foreground...
<img src="images/select-fg.png" alt="select-foreground"></p>
<p>..next, Shift-click on LightSeaGreen. The background and foreground switch to the simulated colors for deuteranopia. Right-clicking on other colors will display those foreground selections with deuteranopia simulation. Shift-click on different colors to change the simulated background.
<img src="images/select-deuteranopia.png" alt="change-simulation"></p>
<p>To display non-interactive pop-up windows of the full color table as seen with deuteranopia, protanopia, tritanopia, and grayscale, use the Ctrl key (or Command key on macOS) with any of the following keys: D, P, T, or G.</p>
<p>Deuteranopia:</p>
<p><img src="images/deuteranopia_colortable.png" alt="deuteranopeia-simulated-colors"></p>
<p>Protanopia:</p>
<p><img src="images/protanopia_colortable.png" alt="protanopeia-simulated-colors"></p>
<p>Tritanopia:</p>
<p><img src="images/tritanopia_colortable.png" alt="tritanopia-simulated-colors"></p>
<p>Grayscale:</p>
<p><img src="images/grayscale_colortable.png" alt="grayscale-simulated-colors"></p>
<h2 id="tk_mvc_template-py">tk_mvc_template.py</h2>
<p>A template for setting up a tkinter application with an MVC architecture. Plenty of comments are provided to explain what is going on.</p>
<h2 id="tk_widget_table-py">tk_widget_table.py</h2>
<p>A template for positioning contiguous widgets in a table format where each Label is bound to various functions. This is the approach used in the tk_color_helper program. While buttons can also be used with this approach, be aware that Button() configurations on MacOS are limited in tkinter.</p>
<p>Example: 15 x 10 table of labels. Colors of several labels were changed by mouse clicks. Texts of labels were defined as serial digits during table construction in a for-loop.</p>
<p><img src="images/widget_table.png" alt="widget-table"></p>
</html>