How can I get the value of colorwell control with interface builder?

I used interface builder to make a plug-in, and I used a colorwell control. How can I get the selected color in real time?

(I suppose you use python).
you can query the color well for its color value: colorWell.color().

You need to check Apples documentation for find out about the properties: https://developer.apple.com/documentation/appkit/nscolorwell?language=objc

If you need to get notified when the color changes, this might help: https://stackoverflow.com/questions/6762052/detecting-an-nscolorwells-changed-selection

Thanks,but I’m sorry.I don’t understand much. If I use python, how can I get the color change in real time?

from AppKit import NSColorWell
colorWell = NSColorWell.alloc().init()
colorWell.activate_(False)

Access the chosen color at anytime with:

colorWell.color()

And close the Color Well window with:

colorWell.deactivate()

Thanks, mekkablue.
I use the image this control in the xlb,I
click it and show the color selector, I want to know if this control has any monitoring events. It can monitor the colors I choose each time?

I see, that is a little more complex. You need to add an observer. Look at the second link @GeorgSeifert posted.

Sorry, I haven’t worked it out for a day today. Can you give me an example for how to add the observer to implement wiht python?Thank you!

Good that you ask. I was also stuck. Now I have a working sample:

Thank you very much. I’m sorry to have brought you so much trouble.:grinning: