PyGtk Color - A couple of python scripts to select a color (for scripting usage)

Overview

PyGtk Color Selection Scripts

This repository contains two scripts to be used within a scripting project, to aquire a color value.

Both scripts

  • require python 3 and its gobject module to be installed.

  • can accept a starting color value in HTML, RGB or RGBA format (#FF00FF, rgb(255,0,255) or rgba(255,0,255,1)).

  • will ignore the transparency value of a RGBA color,

  • can accept an icon (full path to the icon file - parameter -i).

  • will print to stdout the value of the selected color in HTML format by default. RGB or RGBA output formats are also availabe (parameters -r and -a).

1. pygtk-color-chooser

The first script displays a Gtk color chooser window. Clicking the + button will open the color editor.

If the program xcolor (a lightweight color picker for X11) is installed, color picking functionality is enabled (an extra button is added to the window to this end).

The window can be localized (using the -t, -o and -c command line parameters and the LANG=xx_YY.UTF8 locale setting as shown in the image below).

pygtk-color-chooser.png

When a starting color is passed to the script, the color editor will load automatically, as shown in the image below.

pygtk-color-chooser-editor.png

As already stated, when xcolor is available a Pick a color button appears to provide the color picker functionality, as shown in the following animation.

pygtk-color-chooser-xcolor.gif

Finally, this is its help screen:

$ pygtk-color-chooser -h
usage: pygtk-color-chooser [-h] [-e] [-r] [-a] [-t TITLE] [-i ICON]
                           [-o OK_LABEL] [-c CANCEL_LABEL] [-p PICK_LABEL]
                           [color]

A Gtk Color Chooser to be used in scripts. It will print the selected color
value to stdout (will print nothing if Cancel is clicked) and terminate.

positional arguments:
  color                 Specify a default color. This can be in any of the
                        following formats: CSS name, HTML, RGB or RGBA. The
                        widget will automatically change to the color editor
                        view to display the color specified here. If the color
                        value is invalid, it will be ignored.

optional arguments:
  -h, --help            show this help message and exit
  -e, --editor          show the color editor only
  -r, --rgb             print color in rgb format instead of HTML
  -a, --rgba            print color in rgba format instead of HTML
  -t TITLE, --title TITLE
                        set window title
  -i ICON, --icon ICON  set window icon
  -o OK_LABEL, --ok-label OK_LABEL
                        set ok button label
  -c CANCEL_LABEL, --cancel-label CANCEL_LABEL
                        set cancel button label
  -p PICK_LABEL, --pick-label PICK_LABEL
                        set pick button label

2. pygtk-color-selector

The second script displays a Gtk color selector window along with a color picker widget. This is basically the main difference between the two scripts.

Another less significant difference is that the window cannot be manually localized.

The window can be seen in the following image.

pygtk-color-selector.png

Finally, this is its help screen:

$ pygtk-color-selector -h
usage: pygtk-color-selector [-h] [-r] [-a] [-i ICON] [color]

A Gtk Color Selector with Color Picker to be used in scripts. It will print
the selected color value to stdout (will print nothing if Cancel is clicked)
and terminate.

positional arguments:
  color                 Specify a default color. This can be in any of the
                        following formats: CSS name, HTML, RGB or RGBA. If the
                        color value is invalid, it will be ignored.

optional arguments:
  -h, --help            show this help message and exit
  -r, --rgb             print color in rgb format instead of HTML
  -a, --rgba            print color in rgba format instead of HTML
  -i ICON, --icon ICON  set window icon
You might also like...
The friendly PIL fork (Python Imaging Library)
The friendly PIL fork (Python Imaging Library)

Pillow Python Imaging Library (Fork) Pillow is the friendly PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lund

Python QR Code image generator

Pure python QR Code generator Generate QR codes. For a standard install (which will include pillow for generating images), run: pip install qrcode[pil

python binding for libvips using cffi

README PyPI package: https://pypi.python.org/pypi/pyvips conda package: https://anaconda.org/conda-forge/pyvips We have formatted docs online here: ht

The ctypes-based simple ImageMagick binding for Python
The ctypes-based simple ImageMagick binding for Python

Wand Wand is a ctypes-based simple ImageMagick binding for Python, supporting 2.7, 3.3+, and PyPy. All functionalities of MagickWand API are implement

Bringing vtk.js into Dash and Python
Bringing vtk.js into Dash and Python

Dash VTK Dash VTK lets you integrate the vtk.js visualization pipeline directly into your Dash app. It is powered by react-vtk-js. Docs Demo Explorer

python app to turn a photograph into a cartoon
python app to turn a photograph into a cartoon

Draw This. Draw This is a polaroid camera that draws cartoons. You point, and shoot - and out pops a cartoon; the camera's best interpretation of what

Python-based tools for document analysis and OCR

ocropy OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do so

ModernGL is a python wrapper over OpenGL 3.3+ core
ModernGL is a python wrapper over OpenGL 3.3+ core

ModernGL is a python wrapper over OpenGL 3.3+ core that simplifies the creation of simple graphics applications like scientific simulations, games or user interface

Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures.
Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures.

WADs Out For [The] Ladies Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures. Development mostly focused on L

Owner
Spiros Georgaras
Spiros Georgaras
🎨 Generate and change color-schemes on the fly.

Generate and change color-schemes on the fly. Pywal is a tool that generates a color palette from the dominant colors in an image. It then applies the

dylan 6.9k Jan 3, 2023
Simple AI app that is guessing color of apple in picture

Apple Color Determinant Application that is guessing color of apple from image Install Pillow, sklearn and numpy, using command for your package manag

Gleb Nikitin 1 Oct 25, 2021
Tool that takes your photo and generates a pixelated color by number photo.

Color by number Tool that takes your photo and generates a pixelated color by number photo. Requirements You need to have python installed on your com

null 1 Dec 18, 2021
DrawBot is a powerful, free application for macOS that invites you to write Python scripts to generate two-dimensional graphics

DrawBot is a powerful, free application for macOS that invites you to write Python scripts to generate two-dimensional graphics.

Frederik Berlaen 344 Jan 6, 2023
A collection of python scripts which help you programatically create PNGs or GIFs

A collection of python scripts which help you programatically create PNGs or GIFs and their Metadata in bulk with custom rarity rates, upload them to OpenSea & list them for sale.

Tom 30 Dec 24, 2022
㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.

python-barcode python-barcode provides a simple way to create barcodes in Python. There are no external dependencies when generating SVG files. Pillow

Hugo Barrera 419 Dec 26, 2022
Generative Art Synthesizer - a python program that generates python programs that generates generative art

GAS - Generative Art Synthesizer Generative Art Synthesizer - a python program that generates python programs that generates generative art. Examples

Alexey Borsky 43 Dec 3, 2022
Nudity detection with Python

nude.py About Nudity detection with Python. Port of nude.js to Python. Installation from pip: $ pip install --upgrade nudepy from easy_install: $ eas

Hideo Hattori 881 Jan 6, 2023
Python avatar generator for absolute nerds

pagan Welcome to the Python Avatar Generator for Absolute Nerds. Current version: 0.4.3 View the change history here. Remember those good old days whe

David Bothe 280 Dec 16, 2022