Need help: Trying to use PyObject_CallMethod, PyObject_CallFunction, seems to fail quietly.

Parzival Herzog parz at home.com
Wed Aug 1 02:39:49 EDT 2001


I am using ActiveState Python 2.1  on Win 2000.

I am trying to call a method of an object from C, using code like this:

--- in C code:

static PyObject     *_App;
...
      if ( _App )
         PyObject_CallMethod(_App, "OnRClick", "ii", Point.x, Point.y);
...

--- in Python code

class wxApp:

    _top = None

    def __init__(self):
        # Pass self as the object containing "OnRClick" to MyWin extension module
        MyWin.CreateWindow(self, "EmsView 1.0")
        self.OnInit()

    def MainLoop(self):
        MyWin.MessageLoop()

    def SetTopWindow(self,top):
        wxApp._top = top
        top._Establish()

    def OnRedraw(self):
        _top._Draw()

    def OnRClick(self, x, y):
        print "OnRClick x=", x, "y=", y
        event = _PosEvent(0, wxEVT_RIGHT_UP, (x,y))
        _top.ProcessEvent(event)



The PyObject_CallMethod is definitely reached, but the OnRClick method is
apparently not invoked. There are no exceptions or traps.

Using PyObject_CallFunction on a global function seems to behave in the same way.

What am I doing wrong here?

- Parzival





More information about the Python-list mailing list