I’m using wxPython 2.6.3.3 on Python 2.5 on Windows XP Home.
I have a subclass of wx.TextCtrl which contains the following code in its constructor:
self.style = wx.TextAttr
(“black”, wx.NullColour, wx.Font(fontsize,
wx.ROMAN, wx.NORMAL, wx.NORMAL))
self.SetDefaultStyle(self.style)
Simple enough, but sometimes, after a newline, the font in the TextCtrl will revert back to a non-wx.ROMAN font, such as wx.SWISS.
This could easily be a problem in my other code, but I want to check if SetDefaultStyle does what I think it does; that is, make the text in the TextCtrl show up as wx.ROMAN unless otherwise specified.
I can make the text appear as wx.ROMAN always by binding EVT_TEXT with self.SetStyle(0, self.GetLastPosition(), self.style). But that causes flickering, as the TextCtrl highlights itself to change the style.
Am I misinterpreting SetDefaultStyle? Or is there a better way to force a TextCtrl to only show one font?
Thanks,
Saketh