SetStyle() of wx.TextCtrl works differently on Windows and Linux

Hello,

To set style for all text of a wx.TextCtrl:

on Windows

self.te.SetStyle(-1, -1, wx.TextAttr(wx.BLACK, wx.RED))

on Linux

self.te.SetStyle(0, -1, wx.TextAttr(wx.BLACK, wx.RED))

Are there any platform independent constants? In the documentation, I did

not find anything.

Thanks,

Jan Bodnar

A simple demo:

#!/usr/bin/python

-- coding: utf-8 --

import wx

class Example(wx.Frame):

def __init__(self, *args, **kw):

    super(Example, self).__init__(*args, **kw) 

    

    self.InitUI()

    

    

def InitUI(self):   

    

    pnl = wx.Panel(self)



    vbox = wx.BoxSizer(wx.VERTICAL)

    

    self.te = wx.TextCtrl(pnl, style=wx.TE_MULTILINE|

        wx.TE_RICH)

    vbox.Add(self.te, proportion=1, flag=wx.EXPAND)

    

    txt = "Bird\nCat\nDog"

    self.te.AppendText(txt)

    self.te.SetStyle(0, -1, wx.TextAttr(wx.BLACK, wx.RED))    

    

    

    pnl.SetSizer(vbox)

    

    self.SetSize((300, 250))

    self.SetTitle('TextCtrl')

    self.Centre()

    self.Show(True)             

def main():

ex = wx.App()

Example(None)

ex.MainLoop()    

if name == ‘main’:

main()