wxAssertionError on multiline wx.TextCtrl.Copy() in 4.0.4
Tomáš Cerha <[email protected]> Thu, 21 Feb 2019 01:38:26 -0800 (PST)
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, When I invoke .Copy() on a wx.TextCtrl created with style=wx.TE_MULTILINE, a get the following error: wx._core.wxAssertionError: C++ assertion "IsSingleLine()" failed at .../wxPython-4.0.4/ext/wxWidgets/src/gtk/textctrl.cpp(853) in GetEditable(): shouldn't be called for multiline This happens in wxPython 4.0.4 on Linux with GTK+ 3. It didn't happen with wxPython 4.0.3. I also tried to reproduce it with pure wxWidgets in C++ and it didn't happen in wxWidgets 3.0.4. I am attaching a minimal Python code reproducing the problem and also an analogous minimal C++ code demonstrating the non-problem in pure wxWidgets. Am I doing anything wrong? Best regards Tomas Cerha -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
textctrl-copy-assertion-error.py
(text/x-python, 369 B)
#!/usr/bin/env python
import wx
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None, title="Test")
field = wx.TextCtrl(frame, -1, 'abc', style=wx.TE_MULTILINE)
field.SetSelection(0, 2)
field.Copy()
frame.Show()
return True
if __name__ == '__main__':
app = MyApp(redirect=False)
app.MainLoop()
textctrl-copy-assertion-error.cpp
(text/x-c++src, 477 B)
#include <wx/wx.h>
class MyApp: public wxApp
{
public:
virtual bool OnInit();
};
bool MyApp::OnInit() {
wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Test", wxPoint(50, 50), wxSize(260, 140));
wxTextCtrl *field = new wxTextCtrl(frame, wxID_ANY, wxVERSION_STRING, wxPoint(-1, -1),
wxSize(250, 100), wxTE_MULTILINE);
field->SetSelection(0, 2);
field->Copy();
frame->Show(true);
return true;
}
IMPLEMENT_APP(MyApp);