Hello,
I am trying to load a text file into a wxTextCtrl, and I keep getting this message:
Quote:
(test.py:4676): Gtk-CRITICAL **: file gtktextbuffer.c: line 557 (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len, NULL)' failed
|
Here is the code I am using:
Code:
from wxPython.wx import *
class MainWindow(wxFrame):
""" We simply derive a new class of Frame. """
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,wxID_ANY, title, size = ( 400,300),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
control = wxTextCtrl(self, 1, style=wxTE_MULTILINE)
control.LoadFile("/etc/hosts")
self.control = control
self.Show(true)
app = wxPySimpleApp()
frame = MainWindow(None, -1, "Test")
app.MainLoop()
Any help will be appreciated.