Name | Modified | Size | Downloads / Week |
---|---|---|---|
v2.1.3 | 2019-05-28 | ||
2.1.2 | 2017-09-04 | ||
2.0.0 | 2017-07-02 | ||
1.0.0 | 2017-04-28 | ||
README.rst | 2017-09-10 | 2.0 kB | |
Totals: 5 Items | 2.0 kB | 1 |
tkcolorpicker
Color picker dialog for Tkinter.
This module contains a ColorPicker class which implements the color picker and an askcolor function that displays the color picker and returns the chosen color in RGB and HTML formats.
Requirements
- Linux, Windows, Mac
- Python 2.7 or 3.x with tkinter + ttk (default for Windows but not for Linux)
Installation
Ubuntu: use the PPA ppa:j-4321-i/ppa
$ sudo add-apt-repository ppa:j-4321-i/ppa $ sudo apt-get update $ sudo apt-get install python(3)-tkcolorpicker
Archlinux:
the package is available on AUR
With pip:
$ pip install tkcolorpicker
Documentation
Syntax:
askcolor(color="red", parent=None, title=_("Color Chooser"), alpha=False)
Open a ColorPicker dialog and return the chosen color.
The selected color is returned as a tuple (RGB(A), #RRGGBB(AA)) (None, None) is returned if the color selection is cancelled.
Arguments:
color: initially selected color, supported formats:
- RGB(A)
- #RRGGBB(AA)
- tkinter color name (see http://wiki.tcl.tk/37701 for a list)
parent: parent window
title: dialog title
alpha: alpha channel suppport
Example
import tkinter as tk import tkinter.ttk as ttk from tkcolorpicker import askcolor root = tk.Tk() style = ttk.Style(root) style.theme_use('clam') print(askcolor((255, 255, 0), root)) root.mainloop()
Changelog
- tkcolorpicker 2.1.2
- Fix setup.py
- tkcolorpicker 2.1.1
- Fix packaging error
- tkcolorpicker 2.1.0
- Add optional alpha channel support
- tkcolorpicker 2.0.0
- Make package name lowercase to follow PEP 8 guidelines
- Add python 2.7 compatibility
- Make askcolor return (None, None) instead of ()
- tkColorPicker 1.0.0
- Initial version