Range with granurality / step size?

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

Range with granurality / step size?

Michael Aye
Dear all,

is there a way to define a step size or a granurality for a Range trait
for Floats?
For example, for a Range of 0.0 to 1.0 I would like it to jum in steps of 0.1?

Best regards,
Michael


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

Re: Range with granurality / step size?

Robert Kern
On Mon, Dec 5, 2011 at 3:16 PM, K.-Michael Aye <[hidden email]> wrote:
> Dear all,
>
> is there a way to define a step size or a granurality for a Range trait
> for Floats?
> For example, for a Range of 0.0 to 1.0 I would like it to jum in steps of 0.1?

Not really, no.

--
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: Range with granurality / step size?

Thomas Lecocq

Dear,

what you could do is to define a method to update the Range value to the closest multiple of .1 if it _changed() ...

HTH

Thom


> From: [hidden email]
> Date: Mon, 5 Dec 2011 15:21:54 +0000
> To: [hidden email]
> Subject: Re: [Enthought-Dev] Range with granurality / step size?
>
> On Mon, Dec 5, 2011 at 3:16 PM, K.-Michael Aye <[hidden email]> wrote:
> > Dear all,
> >
> > is there a way to define a step size or a granurality for a Range trait
> > for Floats?
> > For example, for a Range of 0.0 to 1.0 I would like it to jum in steps of 0.1?
>
> Not really, no.
>
> --
> Robert Kern
> Enthought
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
     
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Range with granurality / step size?

Michael Aye
On 2011-12-05 15:24:32 +0000, Thomas Lecocq said:

> Dear,
>
> what you could do is to define a method to update the Range value to
> the closest multiple of .1 if it _changed() ...
>
> HTH
Clever! I like that, thanks!

Michael

>
> Thom
>
>
>> From: [hidden email]
>> Date: Mon, 5 Dec 2011 15:21:54 +0000
>> To: [hidden email]
>> Subject: Re: [Enthought-Dev] Range with granurality / step size?
>>
>> On Mon, Dec 5, 2011 at 3:16 PM, K.-Michael Aye
>> <[hidden email]> wrote:
>>> Dear all,
>>>
>>> is there a way to define a step size or a granurality for a Range trait
>>> for Floats?
>>> For example, for a Range of 0.0 to 1.0 I would like it to jum in steps of 0.1?
>>
>> Not really, no.
>>
>> --
>> Robert Kern
>> Enthought
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>      



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

Re: Range with granurality / step size?

mcrucifix
This post has NOT been accepted by the mailing list yet.
apologise this must be a newbie question : how do I notify the Trait that I changed its value, i.e.,

self.myvalue = np.round(self.myvalue,2)

... and then ?