'wxPython copy text with colored characters
I need to display text with different colors in a wxPython application. This part is working. However, when the text is copied from the wx.TextCtrl only the plain text is copied. The color information is lost. I tried also with the wx.RichTextCtrl in the demo and it has the same behavior. Only the raw text is copied.
Is it possible to also copy the color information?
import wx
app = wx.App()
frame = wx.Frame(None, title='Simple application')
text = wx.TextCtrl(frame, style=wx.TE_READONLY|wx.TE_MULTILINE)
text.SetValue('This text sample have three colors. But, color information '
'is not copied to other text editors.')
text.SetStyle(0, 10, wx.TextAttr('BLUE'))
text.SetStyle(21, 35, wx.TextAttr('RED'))
frame.Show()
app.MainLoop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
