FloatSpin strange behavior?

121 views
Skip to first unread message

Carlos Grohmann

unread,
Jun 2, 2009, 10:22:43 PM6/2/09
to wxPython-users
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

Andrea Gavana

unread,
Jun 3, 2009, 3:22:00 AM6/3/09
to wxPytho...@googlegroups.com
Hi,

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/

Carlos Grohmann

unread,
Jun 3, 2009, 2:06:30 PM6/3/09
to wxPython-users
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

Andrea Gavana

unread,
Jun 4, 2009, 8:17:25 AM6/4/09
to wxPytho...@googlegroups.com
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.

Carlos Grohmann

unread,
Jun 4, 2009, 12:55:07 PM6/4/09
to wxPython-users
Turns out it works fine in my VirtualBox Windows as well. Should be
GTK-related.

thanks

Carlos

Juampy

unread,
Mar 29, 2012, 4:17:32 PM3/29/12
to wxpytho...@googlegroups.com, wxPython-users
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,

Juampy

unread,
Mar 29, 2012, 4:31:06 PM3/29/12
to wxpytho...@googlegroups.com, wxPython-users
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,

mbre...@gmail.com

unread,
Oct 14, 2020, 5:14:07 PM10/14/20
to wxPython-users
Sorry for resurrecting this very old thread, but I have the same issue, also on GTK. Are there any new insights to this problem?

Rolf

unread,
Oct 16, 2020, 4:58:37 AM10/16/20
to mbre...@gmail.com, wxPython-users
Not an answer per se, but I had real issues with the size of Gtk3
spinctrls and wrote mini-versions.

i.e. minifloatspin, minispinctrl and minispinbutton

I've attached the minifloatspin.py, try it and see if you get the same
problem. (or others)

run it with: python minifloatspin.py

The others were posted on the board a while back.

Regards,

RolfofSaxony


On 14/10/2020 23:14, mbre...@gmail.com wrote:
> Sorry for resurrecting this very old thread, but I have the same
> issue, also on GTK. Are there any new insights to this problem?
>
> Juampy schrieb am Donnerstag, 29. März 2012 um 22:31:06 UTC+2:
>
> 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.
> --
> You received this message because you are subscribed to the Google
> Groups "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wxpython-user...@googlegroups.com
> <mailto:wxpython-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wxpython-users/d48d811c-0e90-4dbd-96b5-8920a3092209n%40googlegroups.com
> <https://groups.google.com/d/msgid/wxpython-users/d48d811c-0e90-4dbd-96b5-8920a3092209n%40googlegroups.com?utm_medium=email&utm_source=footer>.
minifloatspin.py
Reply all
Reply to author
Forward
0 new messages