Houdini 20.5 Python scripting hou hou.qt

hou.qt.ColorSwatchButton class

A button used for selecting colors with the Houdini look and feel.

On this page

When clicked, the button opens a Houdini color picker dialog.

This class inherits from Qt’s QtWidgets.QPushButton class.

Enums

Position

This enumeration specifies where on the colour swatch to show the secondary color.

.PositionOff

Don’t show on the swatch.

.PositionTop

Show at the top of the swatch.

.PositionBottom

Show at the bottom of the swatch.

.PositionLeft

Show at the left of the swatch.

.PositionRight

Show at the right of the swatch.

.PositionAll

Fille the whole sdwatch.

Signals

colorChanged(QtGui.QColor)

This signal is emitted when the color in the swatch button has changed.

Methods

Examples

This example demonstrates creating a color swatch button and hooking it to a callback function that is invoked when the color changes in the Houdini color picker dialog:

def onColorSelected(color):
    print("Selected color:", color)

color_chooser_btn = hou.qt.ColorSwatchButton()
color_chooser_btn.setSecondaryColorPosition(color_chooser_btn.PositionBottom)
color_chooser_btn.colorSelected.connect(onColorSelected)

hou.qt