Bartzi / tkColorPicker

Color picker dialog for Tkinter, alternative to tkinter.colorchooser

Home Page:https://pypi.python.org/pypi/tkcolorpicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tkcolorpicker

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 with tkinter + ttk (default for Windows but not for Linux) and 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()

About

Color picker dialog for Tkinter, alternative to tkinter.colorchooser

https://pypi.python.org/pypi/tkcolorpicker

License:GNU General Public License v3.0


Languages

Language:Python 100.0%