Re: TextArea Formatting

Neil Hughes <[email protected]>
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
On 11/11/2007 21:46, Ray Allen wrote:
> Is it possible for the textarea component to display multiple fonts? I'd
> like certain keywords to be displayed in another colour.

You could delve into the underlying wxPython and use SetStyle():

         text = self.components.MyTextArea

         text.text = "This is a sample piece of text, with sample in 
reversed text and text in Roman bold."

         reverseAttr = wx.TextAttr("white","black")
         text.SetStyle(10,16,reverseAttr)
         text.SetStyle(37,43,reverseAttr)

         romanAttr = 
wx.TextAttr("black",wx.NullColour,wx.Font(text.GetFont().GetPointSize(), 
wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False))
         text.SetStyle(26,30,romanAttr)
         text.SetStyle(56,60,romanAttr)
         text.SetStyle(65,69,romanAttr)

Any use?
-- 
Neil Hughes

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.