Is it possible to change a widget behaviour?

Hi everyone!
I have a script where I would need to change a widget beheviour. The widget is a color property displayed in a panel. But I would like to change its beheviour when we click on the color(or press a button). But I don’t know if it’s possible and if it is, I don’t know how.

Here is the script for you to have an idea why I need this.

http://www.pasteall.org/21031/python

This script brings palettes to the different paint modes and I am looking into having more colors and implementing the gimp palette format. What I want is to be able to select the color just by clicking it(this would means to execute an operator when clicking it). But right now when clicking a color widget, it brings the color wheel to make adjustments to it. On the higher palette, I made an operator button for each color. But this would be absolutely cumbersome for the lower palette.

If someone could give me some hints, it would be very appreciated.
Thanks!

Oookey! Not so many answers. :confused:

Then I’ll try to help you helping me. :wink:

1. Adapting the current widgets

As you can see, I am trying to do something with a color property. But the widget displayed in the panel does not have the behaviour I want. The color property (FloatVectorProperty) displays a color(this is what I need). But I also need it to execute an operator when clicking it. Right now, clicking it brings the color wheel.

  • So is it possible to create a keymapping that verify the context button under the cursor?

  • Or is it possible to make that widget react to some keymapping?

    1. Creating a new widget

Another possibility would be to create a custom widget like an operator button that shows in a certain color, or even displaying an image into a panel.

  • So is it possible to change the color of a button?
  • Or is it possible to create our own custom widget?

Even a clue saying that “what I want is not possible” would be helpful.
Thank you in advance!