Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

SpinCtrlDouble not allowing me to type dot

Open jonkerj opened this issue 2 years ago • 3 comments

Operating system: MacOS 11.6.4 wxPython version & source: v4.1.1 via pip Python version & source: 3.9.10 via brew

Description of the problem: There are several problems with SpinCtrlDouble on my system, which I think are related:

  • When I try to type a decimal number (e.g. 1.1) into my SpinCtrlDouble, the dot (.) is rejected: system bell sounds and effectively 11 is showing in the control
  • When I use the ^/v buttons to change the number to 1.1, and change focus to a different control, the input is changed to 11
  • When I try to use a comma (eg 1,1) to enter the decimal part, everything after 1, is discarded and the system bell sounds
Code Example (click to expand)
import wx
app = wx.App()
frame = wx.Frame(parent=None, title='bug?')
panel = wx.Panel(parent=frame)
ctrl = wx.SpinCtrlDouble(parent=panel, min=0, max=100, inc=0.1)
frame.Show()
app.MainLoop()

My guess is that it's related by locale settings (because of the comma/dot weirdness), mine are:

$ set | grep -E 'LC_|LANG'
LANG=en_GB.UTF-8
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.15

When I set LANG to C (or unset it), I get the same behaviour, though.

jonkerj avatar Mar 04 '22 09:03 jonkerj

What does wx.GetLocale() report?

swt2c avatar Mar 04 '22 14:03 swt2c

$ python -i main.py
>>> wx.GetLocale()
>>>
$ set | grep -E 'LC_|LANG'
LANG=en_GB.UTF-8
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.15

jonkerj avatar Mar 05 '22 09:03 jonkerj

I tried running the test code on Debian Bullseye with GTK using pip (python 3.9.2 and wx 4.1.1 through a wheel), and it runs fine without issues. Could very well be a mac-specific problem.

jonkerj avatar Mar 14 '22 08:03 jonkerj