Search code examples
python-2.7wxpython

wxpython textctr How I change some text style?


I have the follow problem I have a textctrl and I want some text be different, for example I want text which end's with ':' char to be bold . I need to know if I can by anyway change only this text , I searched but I don't find a clear answer.


Solution

  • Look up wx.Font()

    MyTextCtrl.SetFont(wx.Font(9, family = wx.DEFAULT, style = wx.NORMAL, weight = wx.BOLD, faceName = 'Consolas'))
    

    Although this works for all of the text within the wx.TextCtrl(), so the bold/normal decision would have to made by your code using variables to manage wx.Font()