© Mike Driscoll 2018
Mike DriscollwxPython Recipeshttps://doi.org/10.1007/978-1-4842-3237-8_14

14. XML and XRC

Mike Driscoll
(1)
Ankeny, New York, USA
 

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 ...

Get wxPython Recipes: A Problem - Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.