[Ctk-developers] Observing signals in a CTK widget
Steve Pieper
pieper at isomics.com
Wed Dec 9 01:21:36 UTC 2015
Hi Jonathan -
That widget emits a signal when changed [1], which you can get with the
coordinates property [2]. In python this is available as a string, so
you'll need to parse that to make use of the values.
Here's an example that shows a dialog when the values are changed. You can
just paste it into the slicer python console.
c = ctk.ctkCoordinatesWidget()
c.show()
c.connect('coordinatesChanged(double*)', lambda cc:
qt.QMessageBox.information(None, 'coordinates', c.coordinates))
HTH,
Steve
[1]
http://www.commontk.org/docs/html/classctkCoordinatesWidget.html#a0de7bec85eadf564e911d5c97679f4b9
[2]
http://www.commontk.org/docs/html/classctkCoordinatesWidget.html#af5509939618967dfd9515dc7637990c7
On Tue, Dec 8, 2015 at 8:00 PM, Perdomo, Jonathan <
jonathan_perdomo at med.unc.edu> wrote:
> Hello everyone,
>
> I hope this question has not been asked before, but I am just trying to
> add an observer to my CTK coordinates widget, so that I know whether or not
> the values have been modified by the user. I am writing this in Python as
> an extension for 3D Slicer. Any example of how to add an observer to a
> widget in Python would be very helpful, as well as any sample code you may
> have, or resources you know of!
>
> Thank you for your help,
>
> Jonathan Perdomo
>
>
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/ctk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20151208/ace45431/attachment.htm>
More information about the Ctk-developers
mailing list