Nagarajan Babu
2014-09-08 11:57:30 UTC
Iam new to wxpython. iam trying to load xml in richtextctrl but it's
showing blank. iam using richtextctrl for display xml and images.
class TestFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "A Grid", size=(500, 300))
panel = wx.Panel(self, -1)
self.__editor = editor = self.rtc = rt.RichTextCtrl(self, wx.ID_ANY,
pos=wx.DefaultPosition, size=(390, 388), style=0);
bsizer = wx.BoxSizer()
bsizer.Add(editor, 1, wx.EXPAND)
self.SetSizerAndFit(bsizer)
self.rtc.Freeze()
xml_file = open("E:/books.xml", "r")
xml = xml_file.read()
xml_file.close()
handler = rt.RichTextXMLHandler()
handler.SetFlags(rt.RICHTEXT_HANDLER_INCLUDE_STYLESHEET)
rt_buffer = self.rtc.GetBuffer()
#rt_buffer.AddHandler(handler)
output = StringIO(xml);
handler.LoadStream(rt_buffer, output)
self.rtc.Refresh()
self.rtc.Thaw()
app = wx.App()
frame = TestFrame(None)
frame.Show(True)
app.MainLoop()
and i tried following method also. but still no result.
self.rtc.GetBuffer().AddHandler(rt.RichTextXMLHandler())
stream = StringIO(xml);
rt_buffer = self.rtc.GetBuffer()
rt_buffer.LoadStream(stream, rt.RICHTEXT_TYPE_XML)
please tell me what is missing here.
showing blank. iam using richtextctrl for display xml and images.
class TestFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "A Grid", size=(500, 300))
panel = wx.Panel(self, -1)
self.__editor = editor = self.rtc = rt.RichTextCtrl(self, wx.ID_ANY,
pos=wx.DefaultPosition, size=(390, 388), style=0);
bsizer = wx.BoxSizer()
bsizer.Add(editor, 1, wx.EXPAND)
self.SetSizerAndFit(bsizer)
self.rtc.Freeze()
xml_file = open("E:/books.xml", "r")
xml = xml_file.read()
xml_file.close()
handler = rt.RichTextXMLHandler()
handler.SetFlags(rt.RICHTEXT_HANDLER_INCLUDE_STYLESHEET)
rt_buffer = self.rtc.GetBuffer()
#rt_buffer.AddHandler(handler)
output = StringIO(xml);
handler.LoadStream(rt_buffer, output)
self.rtc.Refresh()
self.rtc.Thaw()
app = wx.App()
frame = TestFrame(None)
frame.Show(True)
app.MainLoop()
and i tried following method also. but still no result.
self.rtc.GetBuffer().AddHandler(rt.RichTextXMLHandler())
stream = StringIO(xml);
rt_buffer = self.rtc.GetBuffer()
rt_buffer.LoadStream(stream, rt.RICHTEXT_TYPE_XML)
please tell me what is missing here.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.