Skip to main content

Color picker dialog for Tkinter

Project description

Latest Release Travis CI Build Status Appveyor Build Status Code coverage Platform Platform Platform License

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

And the python packages:

  • tkinter (included in the python distribution for Windows)
  • Pillow

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:

  • 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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tkcolorpicker, version 2.1.3
Filename, size File type Python version Upload date Hashes
Filename, size tkcolorpicker-2.1.3-py2.7.egg (43.0 kB) File type Egg Python version 2.7 Upload date Hashes View hashes
Filename, size tkcolorpicker-2.1.3-py2-none-any.whl (31.4 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size tkcolorpicker-2.1.3-py3.7.egg (43.2 kB) File type Egg Python version 3.7 Upload date Hashes View hashes
Filename, size tkcolorpicker-2.1.3-py3-none-any.whl (31.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size tkcolorpicker-2.1.3.tar.gz (25.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page