wxPython: How to get letter colour from TextCtrl

D

D. Schramm

Hello,

I've got a problem getting the colour of a single letter within the
TextCtrl widget:

letterstyle = wx.TextAttr()
self.p1.GetStyle(self.p1.XYToPosition(0,0),letterstyle)
color = letterstyle.GetTextColour()
print color

This should display the colour value of the very first letter in the
very first line of the TextCtrl. But no matter what I try, it always
returns the value (-1, -1, -1, 255).

Any help?

Thanks in advance,

Dennis Schramm
 
S

Stef Mientki

Hello,

I've got a problem getting the colour of a single letter within the
TextCtrl widget:

letterstyle = wx.TextAttr()
self.p1.GetStyle(self.p1.XYToPosition(0,0),letterstyle)
color = letterstyle.GetTextColour()
print color

This should display the colour value of the very first letter in the
very first line of the TextCtrl. But no matter what I try, it always
returns the value (-1, -1, -1, 255).

Any help?
AFAIK, TextAttributes are just onw way, you can set them, but never read
them back.

cheers,
Stef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top