What is the best way to learn about wxPython/wxWindows event attributes?

In my quest in learning wxPython, I ran into the issue of figuring out what is available for each event. The demo code is very helpful but does not necessarily show how to do everything. For example, I wanted to know what I could do with an event inside the wxListCtrl demo. I used print to show the type of the event and then tried to use dir() to list all of its attributes. Unfortunately, not all attributes will show with dir().

I wanted to learn more about the event of OnItemSelected(self, event) inside wxListCtrl.py

The event processed by OnItemSelected(self, event) is a SWIG proxy of C++ wxListEvent instance. So I downloaded the source of wxWindows, then used Doxygen to create some form of documentation. Unfortunately, wxListEvent is not in the Doxygen list of classes or coumpounds! So I did a text search inside the source code files of wxWindows to find that the class wxListEvent is defined inside listbase.h and has the m_itemIndex attribute.

Ok, then I look inside the documentation of wxWindows, at wxListEvent topic, but there is no mention of m_itemIndex...

Questions:

1- Why use the protected m_itemIndex attribute of wxListEvent inside the Python demo of wxWindows, instead of just calling the documented GetIndex() which is declared const?

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
     - "print event" to show the proxy type
     - from the proxy type search for the C++ class declaration

Thanks for your help

Pierre

Pierre Rouleau wrote:

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Did it ever cross your mind to download the wxPythonDocs package from
Redirecting... ? :slight_smile:

···

--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/

Pierre Rouleau wrote:

Questions:

1- Why use the protected m_itemIndex attribute of wxListEvent inside the Python demo of wxWindows, instead of just calling the documented GetIndex() which is declared const?

Probably only because when that sample in the demo was first written GetIndex didn't exist.

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Currently that is probably the best way.

···

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

Robin Dunn wrote:

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Currently that is probably the best way.

Oops, I read that too fast and saw "documentation" instead of "declaration." You should get a copy of the docs and use them. The current set is written for C++ but they are usually a little better than reading the source code directly.

···

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

Charl P. Botha wrote:

Pierre Rouleau wrote:

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Did it ever cross your mind to download the wxPythonDocs package from
Redirecting... ? :slight_smile:

Thanks for the tip, but yes. The information inside this document does not answer, unfortunately, my question though. Try to find any mention of m_itemIndex inside this document. Using search does not lead to anything, at least on my system either using viewdocs on wx.zip or simply using the same thing under windows (wx.chm). Does this mean there is no m_itemIndex attribute to anything in wxPython or wxWindows? Of course not. To find out more about it the only way I found so far was to search inside the wxWindows source code.

Therefore my question above: does anyone know a better way?

Note that I was also asking why use m_itemIndex instead of wxListEvent.GetIndex() inside a wxPython demo code.

Pierre

Robin Dunn wrote:

Pierre Rouleau wrote:

Questions:

1- Why use the protected m_itemIndex attribute of wxListEvent inside the Python demo of wxWindows, instead of just calling the documented GetIndex() which is declared const?

Probably only because when that sample in the demo was first written GetIndex didn't exist.

makes sense!

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Currently that is probably the best way.

Thanks Robin

Robin Dunn wrote:

Robin Dunn wrote:

2- Is there a faster way to find out about the attributes of events when using wxPython? What i ultimately used was:
    - "print event" to show the proxy type
    - from the proxy type search for the C++ class declaration

Currently that is probably the best way.

Oops, I read that too fast and saw "documentation" instead of "declaration." You should get a copy of the docs and use them. The current set is written for C++ but they are usually a little better than reading the source code directly.

I agree, and I have the docs. But the docs don't mention thing like wxListEvent::m_itemIndex (which is protected) but does mention wxListEvent::GetIndex(). So, i wanted to know, for sure (maybe an old C++ habit) what this was and wanted also to know what else could be available.

My impression, is that someone should probaly not use m_itemIndex in its wxWindows or wxPython code directly now that public accessors are available.

But the demo source is refered to pretty often so, people will look in there too. I am currently creating a new demo for the wxListCtrl while testing it, i will emove access to m_itemIndex and could send it to you (or should i use cvs?)

Pierre

Pierre Rouleau wrote:

But the demo source is refered to pretty often so, people will look in there too. I am currently creating a new demo for the wxListCtrl while testing it, i will emove access to m_itemIndex and could send it to you (or should i use cvs?)

A patch made using "cvs diff" would be best. See http://wxpython.org/codeguidelines.php

Thanks!

···

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