Phoenix
Phoenix copied to clipboard
Narrow no-break space change font of TextCtrl when using SetValue
Operating system: Windows 10 wxPython version & source: 4.1.1 from pip Python version & source: 3.9.4 from Windows Store
Description of the problem:
A narrow no-break space (U+202F) in the text change the font of a TextCtrl when using SetValue
. See image below:
The narrow no-break space is at the green square position.
Code Example (click to expand)
def __init__(self, *args, **kw) -> None:
self.text_area1 = wx.TextCtrl(pnl, style=wx.TE_MULTILINE | wx.TE_NOHIDESEL)
self.text_area2 = wx.TextCtrl(pnl, style = wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_NOHIDESEL | wx.TE_RICH2)
btn = wx.Button(pnl, label="OK")
btn.Bind(wx.EVT_BUTTON, self.on_press)
font = wx.Font()
font.PointSize = 12
self.text_area1.SetFont(font)
self.text_area2.SetFont(font)
def on_press(self, event):
self.text_area2.SetValue(self.text_area1.GetValue())