P
Pom
Hello
I have a tuple of strings which I must show in a textctrl, each item in
the tuple representing one line of text.
The first three lines of text should each have another style (fontsize
and color)
i'm using this code to achieve this:
tmppos = self.txtInfo.GetInsertionPoint() # get the cursor pos
self.txtInfo.write(str(csr[0])+'\n')
tmppos2 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos, tmppos2, wx.TextAttr("BLUE",
wx.NullColour, tmpnewfont))
self.txtInfo.write(str(csr[1])+'\n')
tmppos3 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos2, tmppos3, wx.TextAttr("BLUE",
wx.NullColour, tmpnewfont2))
self.txtInfo.write(str(csr[2])+'\n')
tmppos4 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos3, tmppos4, wx.TextAttr(wx.Nullcolour,
wx.NullColour, tmpnewfont3))
Now, I was wondering if this is the right way of doing this, because I
have the feeling this code sucks.
Anybody has a better way of doing this?
Thx !!!
I have a tuple of strings which I must show in a textctrl, each item in
the tuple representing one line of text.
The first three lines of text should each have another style (fontsize
and color)
i'm using this code to achieve this:
tmppos = self.txtInfo.GetInsertionPoint() # get the cursor pos
self.txtInfo.write(str(csr[0])+'\n')
tmppos2 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos, tmppos2, wx.TextAttr("BLUE",
wx.NullColour, tmpnewfont))
self.txtInfo.write(str(csr[1])+'\n')
tmppos3 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos2, tmppos3, wx.TextAttr("BLUE",
wx.NullColour, tmpnewfont2))
self.txtInfo.write(str(csr[2])+'\n')
tmppos4 = self.txtInfo.GetInsertionPoint() # get the new cursor pos
self.txtInfo.SetStyle(tmppos3, tmppos4, wx.TextAttr(wx.Nullcolour,
wx.NullColour, tmpnewfont3))
Now, I was wondering if this is the right way of doing this, because I
have the feeling this code sucks.
Anybody has a better way of doing this?
Thx !!!