Recipe 14-1. Extracting XML from the RichTextCtrl
Problem
The RichTextCtrl gives you the ability to use styled text. It also provides a few different handlers to save the data it contains into various formats. One of those happens to be XML. In this recipe, we will learn how to extract XML from the
RichTextCtrl
.
Solution
The RichTextCtrl
is a part of wx.richtext which you will need to import in addition to the wx module. It’s easiest to understand if we just go ahead and code an example.
# wxPython Classic version
import wx
import wx.richtext
from StringIO import StringIO
class MyFrame(wx.Frame):
def ...