GTK error messages

98 views
Skip to first unread message

Michael Eager

unread,
Dec 28, 2020, 4:28:24 PM12/28/20
to wx-u...@googlegroups.com, wxpytho...@googlegroups.com
I'm running a wxPython program using a wx.ScrolledWindow. I'm getting a
lot of the following console messages:

(main.py:1170792): Gtk-CRITICAL **: 08:59:46.366:
gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

I'm guessing that there is something in the way that the ScrolledWindow
widget is initialized that is incorrect or incomplete.

Can anyone suggest how to debug this?

What's the best way to track back from a GTK error to the wxWidgets code
triggering the error?

wxWidgets Library Version 3.1.5, Compiled Dec 17, 2020 (using pip3).
Runtime version 3.22. Compile-time GTK 3.22.30.

--
Michael Eager

Scott Talbert

unread,
Dec 28, 2020, 9:39:09 PM12/28/20
to wx-u...@googlegroups.com, wxpytho...@googlegroups.com
Unfortunately, GTK is rather noisy with its warnings and this doesn't
*necessarily* indicate that there's a bug somewhere (although there could
be). Do you see any problems in your application?

You can make a GTK program abort on the first warning using a special
command line option, --g-fatal-warnings. With this you can get a stack
trace with gdb when the warning occurs. Doing it with Python is a little
tricky, but here's how you can do it:

$ gdb python3

...

(gdb) run <your program>.py --g-fatal-warnings

Then you should be able to get a stack trace, debug, etc. when one of
those warnings occurs.

Scott

Michael Eager

unread,
Dec 29, 2020, 11:54:58 AM12/29/20
to wxpytho...@googlegroups.com, Scott Talbert, wx-u...@googlegroups.com
Thanks. I'll give that a try.

Would it help to build a local debug version of wxWidgets?


--
Michael Eager

Michael Eager

unread,
Jan 7, 2021, 10:52:32 AM1/7/21
to wx-u...@googlegroups.com, wxpytho...@googlegroups.com
On 1/5/21 1:13 PM, Vadim Zeitlin wrote:
> On Tue, 05 Jan 2021 09:20:30 +0100 Gunter Königsmann wrote:
>
> GK> If that would be a possible feature of wxLogger? The option to redirect
> GK> gtk messages to a log panel, along with the wxWidgets one?
>
> I'm not sure if it really makes sense for wxLog, which is about
> (re)directing the messages generated by wx programs somewhere, not about
> intercepting the messages from somewhere else. This functionality also
> doesn't have any portable equivalent, AFAIK. So I think that the best we
> could do would be to provide some GTK-specific function for such
> redirection, but this doesn't have much advantage compared to just doing
> the same thing in the application code.


It may not make sense for wxLog, but if GTK generates spurious messages
with wx, putting some kind of GTK message manager in the wx library
seems like a good idea.

In a C/C++ program, it may be easy to just put the code in the
application. With wxPython, it's more awkward. If one takes my
approach, using a separate library, it needs to be built, distributed,
and installed along with the Python code. It would be better to be in
wx and wrapped by wxPython.

--
Michael Eager

Karsten Hilbert

unread,
Jan 7, 2021, 11:13:47 AM1/7/21
to wxpytho...@googlegroups.com
> It may not make sense for wxLog, but if GTK generates spurious messages
> with wx, putting some kind of GTK message manager in the wx library
> seems like a good idea.

_Especially_ if that message manager can then be used to redirect
those messages to a log file to be used for debugging conditions
on remote clients. Ideally one could funnel them into

import logging
_log = logging.Logger()
wx.redirect_spurious_copious_and_gratuitious_gtk_messages(target = _log)

or some such :-)

Karsten

Jill Holliday

unread,
Jan 7, 2021, 12:02:10 PM1/7/21
to wxPython-users
That sounds like a really good idea.  I have trouble with similar messages which often seem to be linked to notebook pages created on startup.

Karsten Hilbert

unread,
Jan 7, 2021, 3:44:09 PM1/7/21
to wxpytho...@googlegroups.com
> _Especially_ if that message manager can then be used to redirect
> those messages to a log file to be used for debugging conditions
> on remote clients.

To be fair: one probably already can by capturing STDOUT/STDERR
when invoking the python interpreter.

Karsten
Reply all
Reply to author
Forward
0 new messages