Puzzled by Traits variable dependence

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Puzzled by Traits variable dependence

Jonathan Mackenzie
I have come across the following behaviour in Traits which I was not
expecting.

Is this by design, or a bug?

I have assigned a non-trait integer to the value of a scatter plot selection,
itselfa TraitDictObject. When the selection is changed, the value of my
assigned int changes also. I have not explicitly made my int a trait object,
nor setup any dependencies between it and the plot metadata, and so I
would expect it not to change.

If this is by design, then how do I store a value of a trait so that it does not
change when the original does?

Any help much appreciated,

Jonathan

--------------------
Dr Jonathan Mackenzie
Research Associate
Martinez-Arias Lab
Dept. of Genetics
University of Cambridge
Cambridge, CB2 3EH, UK

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Puzzled by Traits variable dependence

Robert Kern
On Mon, Nov 12, 2012 at 2:31 PM, Jonathan Mackenzie <[hidden email]> wrote:

> I have come across the following behaviour in Traits which I was not
> expecting.
>
> Is this by design, or a bug?
>
> I have assigned a non-trait integer to the value of a scatter plot selection,
> itselfa TraitDictObject. When the selection is changed, the value of my
> assigned int changes also. I have not explicitly made my int a trait object,
> nor setup any dependencies between it and the plot metadata, and so I
> would expect it not to change.
>
> If this is by design, then how do I store a value of a trait so that it does not
> change when the original does?

Can you post a small, self-contained example that demonstrates this
behavior? I'm afraid that I can't tell what you are doing from your
description.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Puzzled by Traits variable dependence

Jonathan Mackenzie

 
 Thanks for your reply. I have just extracted what I thought were the parts
involved in this problem from my software, but I could not reproduce the
behaviour I was getting. Doing this helped me to see that I was unwittingly
triggering an on_trait_change handler and causing my grief.

So, problem solved.

Thanks again,

J




_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev