I am starting to use the wxPython available in debian (woody and sarge).
In the docs about wxListBox, I found that EVT_LISTBOX(id, func) is the
event handler for item selection. However, when I use it, I get a
python error saying that the function needs 3 arguments and only 2 are
provided.
In fact, searching in the module file wx.py, I found this definition:
···
+++++++++++++++++++++++++++
def EVT_LISTBOX(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED, func)
---------------------------
In wx.py, many events are defined without "id" argument, and with it set
as "-1" in the win.Connect call, as for instance here:
++++++++++++++++++++++++++++++
def EVT_CHAR(win, func):
win.Connect(-1, -1, wxEVT_CHAR, func)
------------------------------
So I tryed to call the EVT_LISTBOX function with "-1" as id, and it
*seemed* to work. I am not quite sure about it working properly,
because upon exit I *sometimes* got a messages like this on stderr:
+++++++++++++++++++++++++++++++++++++++
Gtk-WARNING **: invalid cast from `GtkCornerType' to `GtkObject'
Gtk-WARNING **: invalid cast from `GtkCornerType' to `GtkObject'
Gtk-CRITICAL **: file gtkwidget.c: line 2728 (gtk_widget_event):
assertion `GTK_IS_WIDGET (widget)' failed.
---------------------------------------
Anyway, I am not sure about these errors being related with the event
handler problem above.
My questions are:
1-Which is wrong, the docs that talk about the function having 2
arguments, or the code that makes it with 3? Please note that *many*
event handlers are documented as having 2 arguments while in fact wx.py
implement them with 3!
2-Must I expect problems from the quick-and-dirt fix of making id=3D-1?
Thanks for all,
Sebrosa