[wxPython] problem with wxTextCtrl.GetScrollPos()

I'm testing a wxPython program on wxGTK, which was originally written and tested on Windows. I have a frame with a wxTextCtrl, and I need to figure out which lines are currently visible. For this purpose, I've been using the GetScrollPos (inherited from wxWindow) method to find the top visible line. This works fine on Windows (Win98SE, wxPython 2.3.2.1, Python 1.52).

However, when I run the program on Linux (Mandrake 8.1, wxPython 2.3.3.1, Python 2.1), I get a message like

[Debug] 08:54:41 PM: ../src/gtk/window.cpp(4122): assert "wxFalse" failed: window needs client area for scrolling

The same thing happens if I try to call any of the other Scrollbar-related messages.

I've reproduced this in a minimal sample, which I've attached.

Does anyone else see this behaviour? What does it mean, and how do I avoid it?

Thanks,
David

text.py (858 Bytes)

David C. Fox wrote:

However, when I run the program on Linux (Mandrake 8.1, wxPython 2.3.3.1, Python 2.1), I get a message like

[Debug] 08:54:41 PM: ../src/gtk/window.cpp(4122): assert "wxFalse" failed: window needs client area for scrolling

The same thing happens if I try to call any of the other Scrollbar-related messages.

I've reproduced this in a minimal sample, which I've attached.

Does anyone else see this behaviour? What does it mean,

Unfortunatly in wxGTK the native widgets do not inherit all the capabilities of wxWindow. The way scrolling is implemented for the non-native windows (wxWindow, wxPanel, wxScrolledWindow, etc.) just will not work with the native widgets, but they handle their own scrolling internally.

and how do I avoid it?

I don't think you can, other than not using wxTextCtrl.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!