FloatSpin strange behavior?

Hello all,

I'm using Andrea's FloatSpin in an app, and it works fine but there is
one small issue: if I set the initial value to, say, 3.5 (with steps
of 0.5), and the first thing I do when I run the pregram is to
decrease that value, it will go from 3.5 to 4.0, then 3.5 and then
finally 3.0. If I run the program and try to increase the values,it's
all good. Any hints?

cheers

Hi,

Hello all,

I'm using Andrea's FloatSpin in an app, and it works fine but there is
one small issue: if I set the initial value to, say, 3.5 (with steps
of 0.5), and the first thing I do when I run the pregram is to
decrease that value, it will go from 3.5 to 4.0, then 3.5 and then
finally 3.0. If I run the program and try to increase the values,it's
all good. Any hints?

I can't reproduce the behavious using FloatSpin from SVN. How many
significant digits are you using in FloatSpin? Could you please make a
small sample app which demonstrates the problem?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Wed, Jun 3, 2009 at 3:22 AM, Carlos Grohmann wrote:

Here it goes. (I'm using wx 2.8.10.1 from wx repositories in Ubuntu
8.10)

#!/usr/bin/python

# spinctrl.py

import wx
import wx.lib.agw.floatspin as FS

class Sample(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size=(100, 100))

        self.polespin = FS.FloatSpin(self, -1, size=(60, -1),
value=3.0, min_val=1, max_val=20, increment=0.5, digits=1)

        self.Centre()
        self.ShowModal()
        self.Destroy()

    def OnClose(self, event):
        self.Destroy()

app = wx.App()
Sample(None, -1, 'Converter')
app.MainLoop()

I noticed that if I change the values with the mouse wheel, it works
fine, but using the up/down arrows I got the problem.

cheers

···

On Jun 3, 4:22 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On Wed, Jun 3, 2009 at 3:22 AM, Carlos Grohmann wrote:

> Hello all,

> I'm using Andrea's FloatSpin in an app, and it works fine but there is
> one small issue: if I set the initial value to, say, 3.5 (with steps
> of 0.5), and the first thing I do when I run the pregram is to
> decrease that value, it will go from 3.5 to 4.0, then 3.5 and then
> finally 3.0. If I run the program and try to increase the values,it's
> all good. Any hints?

I can't reproduce the behavious using FloatSpin from SVN. How many
significant digits are you using in FloatSpin? Could you please make a
small sample app which demonstrates the problem?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/

Hi,

Here it goes. (I'm using wx 2.8.10.1 from wx repositories in Ubuntu
8.10)

#!/usr/bin/python

# spinctrl.py

import wx
import wx.lib.agw.floatspin as FS

class Sample(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(100, 100))

   self\.polespin = FS\.FloatSpin\(self, \-1, size=\(60, \-1\),

value=3.0, min_val=1, max_val=20, increment=0.5, digits=1)

   self\.Centre\(\)
   self\.ShowModal\(\)
   self\.Destroy\(\)

def OnClose(self, event):
self.Destroy()

app = wx.App()
Sample(None, -1, 'Converter')
app.MainLoop()

I noticed that if I change the values with the mouse wheel, it works
fine, but using the up/down arrows I got the problem.

Your sample works perfectly well for me on Windows XP, Python 2.5,
wxPython 2.8.10.1. I believe it might be a quirk of wx.SpinButton on
GTK, but I can't say it for sure as I don't have a GTK machine to hunt
for the bug.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Wed, Jun 3, 2009 at 7:06 PM, Carlos Grohmann wrote:

Turns out it works fine in my VirtualBox Windows as well. Should be
GTK-related.

thanks

Carlos

···

On Jun 4, 9:17 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On Wed, Jun 3, 2009 at 7:06 PM, Carlos Grohmann wrote:

> Here it goes. (I'm using wx 2.8.10.1 from wx repositories in Ubuntu
> 8.10)

> #!/usr/bin/python

> # spinctrl.py

> import wx
> import wx.lib.agw.floatspin as FS

> class Sample(wx.Dialog):
> def __init__(self, parent, id, title):
> wx.Dialog.__init__(self, parent, id, title, size=(100, 100))

> self.polespin = FS.FloatSpin(self, -1, size=(60, -1),
> value=3.0, min_val=1, max_val=20, increment=0.5, digits=1)

> self.Centre()
> self.ShowModal()
> self.Destroy()

> def OnClose(self, event):
> self.Destroy()

> app = wx.App()
> Sample(None, -1, 'Converter')
> app.MainLoop()

> I noticed that if I change the values with the mouse wheel, it works
> fine, but using the up/down arrows I got the problem.

Your sample works perfectly well for me on Windows XP, Python 2.5,
wxPython 2.8.10.1. I believe it might be a quirk of wx.SpinButton on
GTK, but I can't say it for sure as I don't have a GTK machine to hunt
for the bug.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/

Hi Andrea,

I know this thread have quite some time, but I stomped into this now. Is there any workaround to have it working on GTK?

By the way, thanks for such great job on the AGW library.

Regards,

···

On Tuesday, June 2, 2009 11:22:43 PM UTC-3, Carlos Grohmann wrote:

Hello all,

I’m using Andrea’s FloatSpin in an app, and it works fine but there is

one small issue: if I set the initial value to, say, 3.5 (with steps

of 0.5), and the first thing I do when I run the pregram is to

decrease that value, it will go from 3.5 to 4.0, then 3.5 and then

finally 3.0. If I run the program and try to increase the values,it’s

all good. Any hints?

cheers

The odd behavior is that it only happens around the “original value”. Lets say you set the value on 25 with increments of 1. If you press the up arrow it will go: 25, 26, 27, 28, etc… But if you press the down arrow it will go: 25, 26 , 25 , 24,23,22, etc.

Another odd thing is that it repeats its behavior every time you go through 25. For example, if you start on 25, and press the up arrow until you reach 28 and then go down, it will go: 28, 27, 26, 25, 26, 25, 24, 23, 22, etc.

It doesn’t matter the increment of the arrow and/or the initial value. If you start on 10, with 0.2 increments, it will go: 10, 10.2, 10, 9.8, 9.6, etc.

I’ve also noticed that either reaching the max_val or min_val, or doing a “press and hold” on the arrow (so it will increase the value faster) makes the FloatSpin work as it should.

I really think that this is GTK related, but in any case if you have a clue on how could I workaround this, would be really helpful.

Best Regards,

···

On Thursday, March 29, 2012 5:17:32 PM UTC-3, Juampy wrote:

Hi Andrea,
I know this thread have quite some time, but I stomped into this now. Is there any workaround to have it working on GTK?

By the way, thanks for such great job on the AGW library.

Regards,

On Tuesday, June 2, 2009 11:22:43 PM UTC-3, Carlos Grohmann wrote:

Hello all,

I’m using Andrea’s FloatSpin in an app, and it works fine but there is

one small issue: if I set the initial value to, say, 3.5 (with steps

of 0.5), and the first thing I do when I run the pregram is to

decrease that value, it will go from 3.5 to 4.0, then 3.5 and then

finally 3.0. If I run the program and try to increase the values,it’s

all good. Any hints?

cheers