PETRONODE

2. Petronode.ColorPicker.exe

This application shows RGB color selection box

The command line parameter controls the default color in the form.

The application returns the RGB color as an integer.

Petronode.ColorPicker.exe /r RRGGBB[RRGGBB...]

    /r (optional) - indicates a 'single click' mode

    RRGGBB[RRGGBB...] (optional)

        - specifies the default color and custom colors

        Up to 27 custom colors can be specified in the form

The following example illustrates the usege in the user script:

#

# Example 2 - picking color

#

import os

import subprocess

#

# location of Petronode install folder

#

cBatchProcessorFolder = "C:\\Program Files\\Petronode"

#

# Calls the color picker for single click selection

# returns the user color

#

def ColorPicker ( default_color = "none", OneClick = True):

    template = "0123456789ABCDEF"

    Params = [os.path.join( cBatchProcessorFolder, "Petronode.ColorPicker.exe")]

    if OneClick: Params += [ "/r"]

    if default_color != "none": Params += [ default_color]

    i = subprocess.call( Params)

    if i<0 or i > 16777215: return "none"

    label = ""

    while i > 0:

        label = template[i % 16] + label

        i = int(i/16)

    while len(label) < 6: label = "0" + label

    return label

#

# Set default color to red (FF0000) and add one custom color (74EB70)

#

print( "User Selected: " + ColorPicker("FF000074EB70"))


The user interface is as following:


ColorPicker_Help