[wxPython] Does wxEvent knows its Creator?

Hi wxPython People,
I have a simple question, see the docstring of the example programm
below. And please carbon-copy me answers as I am not subscribed on
the list.

Thanks in advance,
  Bernhard

wxpython_frage.py (1.89 KB)

···

--
Professional Service around Free Software (intevation.net)
The FreeGIS Project (freegis.org)
Association for a Free Informational Infrastructure (ffii.org)
FSF Europe (fsfeurope.org)

How can I get the Object which caused an event from the wxEvent Object
in wxPython.

I am working on making this MUCH better in the 2.3 release, which will hopefully be the release after the one I am releasing in a couple days.

To me it looks like I am getting an wxObject back,
but I cannot call the windows methods on it. Do I have to cast it
in some way? Are there standard methods in wxPython?

If you know what kind of object it truly is then you can use wxPyTypeCast to create a new shadow class object of the proper type. It won't be your original Python object, but a new Python wrapper object around the original C++ object. See the docs and implementation of this function in wx.py.

Wouldn't it be better to actually return the right
object from the python wrapper code?

Yep, and that's what I am working on for 2.3. There's two levels of functionality:

    1. Do automatically what wxPyTypeCast does.
    2. Track and return the original Python object.

I know I can do #1. I am hopeful that I can find a way to do #2 without leaking memory.

···

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

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

Hello Robin,

Wednesday, January 31, 2001, 8:38:07 PM, you wrote:

Wouldn't it be better to actually return the right
object from the python wrapper code?

Yep, and that's what I am working on for 2.3. There's two levels of functionality:

    1. Do automatically what wxPyTypeCast does.
    2. Track and return the original Python object.

I know I can do #1. I am hopeful that I can find a way to do #2 without leaking memory.

Author of FOXPy said in last changelog that FOXPy now does #2. Maybe
this can help you.

···

--
regards,
Niki Spahiev

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

Thanks for answering the question and the good work!
  Bernhard

···

On Wed, Jan 31, 2001 at 10:38:07AM -0800, Robin Dunn wrote:

> How can I get the Object which caused an event from the wxEvent Object
> in wxPython.

I am working on making this MUCH better in the 2.3 release, which
will hopefully be the release after the one I am releasing in a
couple days.

--
Professional Service around Free Software (intevation.net)
The FreeGIS Project (freegis.org)
Association for a Free Informational Infrastructure (ffii.org)
FSF Europe (fsfeurope.org)

Quoth Robin Dunn:
> 2. Track and return the original Python object.
> I know I can do #1. I am hopeful that I can find a way to do #2
without leaking memory.

Does this revolve the necessity of having a weak reference somewhere to
avoid a circular reference?
Do Python 2.0's new ways of cleaning up circular references help?

Warren Postma

···

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users