wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.32k stars 519 forks source link

wx.lib.editor.Editor gets stuck in a loop generating "drawing failure for widget" messages #2633

Open reticulatus opened 19 hours ago

reticulatus commented 19 hours ago

Operating system: Linux Mint 22 wxPython version & source: wxPython 4.2.2 gtk3 (phoenix) wxWidgets 3.2.6 from pypi Python version & source: 3.12.3 from distro

It also occurs with wxPython 4.2.1 gtk3 (phoenix) wxWidgets 3.2.2.1 + Python 3.10.12 + Linux Mint 21.3

Description of the problem:

In the wxPython demo, the Editor control never fully appears. Continuous warning messages are output to the command line.

As a side effect, entries in the demo's tree control for other recently used examples turn invisible on a grey background.

See this animated gif (click the play button, if necessary):

editor_demo_1-2024-10-29_11 20 49

Code Example (click to expand) This is the example from the demo, modified to run stand-alone: ```python import wx import wx.lib.editor as editor class TestFrame(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent) win = wx.Panel(self, -1) ed = editor.Editor(win, -1, style=wx.SUNKEN_BORDER) box = wx.BoxSizer(wx.VERTICAL) box.Add(ed, 1, wx.ALL|wx.GROW, 1) win.SetSizer(box) win.SetAutoLayout(True) ed.SetText(["", "This is a simple text editor, the class name is", "Editor. Type a few lines and try it out.", "", "It uses Windows-style key commands that can be overridden by subclassing.", "Mouse select works. Here are the key commands:", "", "Cursor movement: Arrow keys or mouse", "Beginning of line: Home", "End of line: End", "Beginning of buffer: Control-Home", "End of the buffer: Control-End", "Select text: Hold down Shift while moving the cursor", "Copy: Control-Insert, Control-C", "Cut: Shift-Delete, Control-X", "Paste: Shift-Insert, Control-V", ""]) if __name__ == '__main__': app = wx.App() frame = TestFrame(None) frame.Show() app.MainLoop() ``` The first few error message on the command line: ``` (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.814: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.815: drawing failure for widget 'GtkScrolledWindow': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.815: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.815: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.815: drawing failure for widget 'GtkBox': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.815: drawing failure for widget 'GtkWindow': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.824: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.824: drawing failure for widget 'GtkScrolledWindow': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.824: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.824: drawing failure for widget 'wxPizza': invalid value for an input cairo_format_t (Editor_2.py:8883): Gtk-WARNING **: 13:25:30.824: drawing failure for widget 'GtkBox': invalid value for an input cairo_format_t ```
reticulatus commented 15 hours ago

Further experiments with the Code Example indicate that the OnPaint() method is repeatedly being called.

If I drag the editor's vertical scrollbar to the bottom and the horizontal scrollbar to the right, then the messages stop being generated. However, the text is never displayed.