ColorButton example with Parameter Tree?

21 views
Skip to first unread message

JMA 1

unread,
Apr 27, 2020, 9:31:08 PM4/27/20
to pyqtgraph
I'm new to the package and python, which means I'm struggling a bit.  When trying the parameter_tree.py, the color button that is a child parameter does not specify a valid color.  When launched, the icon on the r.h.s of the parameter value indicates it's a changed value.  What is the valid syntax for applying a number?  When using the color-picker, it generates a color object not a number.  

examples:
{ 'name' : 'Coplor', 'type' : 'color', 'value' : "FF0", },

child.setValue( format??? )
"FF0", "0xFF0", "#332211", etc. do not seem to be the correct format

Any ideas?  

Thank you in advance.


Cheers,
J - 

megan kratz

unread,
Apr 27, 2020, 9:56:49 PM4/27/20
to pyqt...@googlegroups.com
Welcome to pyqtgraph!

The arguments for color value can be any valid argument for pyqtgraph.functions.mkColor. Here's the docstring for that function:

    """
    Convenience function for constructing QColor from a variety of argument types. Accepted arguments are:
   
    ================ ================================================
     'c'             one of: r, g, b, c, m, y, k, w                      
     R, G, B, [A]    integers 0-255
     (R, G, B, [A])  tuple of integers 0-255
     float           greyscale, 0.0-1.0
     int             see :func:`intColor() <pyqtgraph.intColor>`
     (int, hues)     see :func:`intColor() <pyqtgraph.intColor>`
     "RGB"           hexadecimal strings; may begin with '#'
     "RGBA"          
     "RRGGBB"      
     "RRGGBBAA"    
     QColor          QColor instance; makes a copy.
    ================ ================================================
    """

Hope that helps!

Megan

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/b746d074-5f78-4471-9c40-7421fe718483%40googlegroups.com.

megan kratz

unread,
Apr 27, 2020, 10:00:51 PM4/27/20
to pyqt...@googlegroups.com
Also, if you're converting numbers into colors you may find pyqtgraph.functions.intColor to be useful.

JMA 1

unread,
Apr 27, 2020, 10:07:28 PM4/27/20
to pyqtgraph
Greetings,
Thank you.  I think I found my silly mistake.  I appreciate the information and quick responses.

Cheers,
J- 
To unsubscribe from this group and stop receiving emails from it, send an email to pyqt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages