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 ¶
__init__(include_alpha=False)
Create and return a new ColorSwatchButton object.
include_alpha
If True, then an alpha component is added to the color swatch button.
color()
→ QtGui.QColor
Return the button’s current color.
setColor(color)
Set the button’s current color.
color
QtGui.QColor
object of the desired color.
hasAlpha()
→ bool
Return if the button will show an alpha value.
secondaryColor()
→ QtGui.QColor
Return the button’s optional secondary color. The secondary color isn’t modified using this button’s UI and is there for visual comparison only.
setSecondaryColor(color)
Set the button’s secondary color.
color
QtGui.QColor
object of the desired color.
secondaryColorPosition()
→ hou.qt.ColorSwatchButton.Position
Return the position of the button’s optional secondary color.
setSecondaryColorPosition(color)
Set the position of the button’s secondary color.
position
hou.qt.ColorSwatchButton.Position object of the desired color.
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)