Phoenix
Phoenix copied to clipboard
SpinCtrlDouble not allowing me to type dot
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 mySpinCtrlDouble
, the dot (.
) is rejected: system bell sounds and effectively11
is showing in the control - When I use the
^
/v
buttons to change the number to1.1
, and change focus to a different control, the input is changed to11
- When I try to use a comma (eg
1,1
) to enter the decimal part, everything after1,
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.
What does wx.GetLocale()
report?
$ 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
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.