pythonenaml

Enaml: How to style a CheckBox


I'm trying to get the check in a CheckBox to be more visible when the window is not selected. See the difference in the pics below.

I've had no luck in trying to style it with:

    Style:
        element = 'CheckBox'
        Setter:
            field = 'background'
            value = 'yellow '

    Style:
        element = 'CheckBox'
        Setter:
            field = 'color'
            value = 'red'

As you can see, this does not style the actual checkbox, only the text field.

So, any ideas on how to style the actual checkbox?

enter image description here enter image description here


Solution

  • Enaml doesn't have control over how the checkbox is rendered. If you really need that level of customization, you'll need to write your own custom Qt widget which paints its own checkbox, and then wrap that widget as an Enaml widget.