×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    How to call function from python?

    I wrote following function in symbians60 3rd edition and want to use in through python application but how to pass argument i don't know please help me.

    I highlighted function with green color. please help me how i can pass other arguments.

    I try integrate VRex (VideoExample)Symbian Example with Python.

    Symbina Function
    -----------------

    void CDLLExample::InitControlL(MPlayerUIListener* aCallback,
    RWsSession& aWs,
    CWsScreenDevice& aScreenDevice,
    RWindowBase& aWindow,
    TRect& aScreenRect,
    TRect& aClipRect,
    TDesC& aURL)
    {
    }

    For use above function in python i change following way

    static int CDLLExample::InitControlL(MPlayerUIListener* aCallback,
    RWsSession& aWs,
    CWsScreenDevice& aScreenDevice,
    RWindowBase& aWindow,
    TRect& aScreenRect,
    TRect& aClipRect,
    TPtrC& aURL)
    {
    .
    .
    return 1;
    }

    static PyObject* sdk12graphics_InitControlL(PyObject *self, PyObject *args)
    {
    TInt error;
    char* b;
    int l;

    if (!PyArg_ParseTuple(args, "u#", &b, &l))
    {
    //Py_INCREF(Py_None);
    return SPyErr_SetFromSymbianOSErr(error); //Py_None;
    }

    TPtrC aUrl((TUint16*)b, l);


    return Py_BuildValue("i",InitControlL(aUrl));
    }


    static const PyMethodDef sdk12graphics_methods[] =
    {
    {"InitControlL", (PyCFunction)sdk12graphics_InitControlL, METH_VARARGS, "Returns a CObject with a CFbsBitmap*"},
    {NULL, NULL} /* sentinel */
    };

    #define METHOD_TABLE const_cast<PyMethodDef*>(&sdk12graphics_methods[0])

    extern "C" {
    DL_EXPORT(void) MODULE_INIT_FUNC(void)
    {
    // Add extra initialization here
    PyObject* module = Py_InitModule(MODULE_NAME_STRING, METHOD_TABLE);
    if (!module)
    {
    return;
    }
    }
    }

    #ifndef EKA2
    GLDEF_C TInt E32Dll(TDllReason)
    {
    return KErrNone;
    }
    #endif

    Regards,
    SymbianTH
    Last edited by SymbianTH; 2009-07-09 at 10:39. Reason: forget highlight some portion

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: How to call function from python?

    InitControlL doesn't return an integer, does it? Why do you use the following statement then?
    Code:
    return Py_BuildValue("i",InitControlL(aUrl));
    Pankaj Nathani
    www.croozeus.com

Similar Threads

  1. Python for S60 1.9.3 released
    By tvijayan in forum Symbian
    Replies: 40
    Last Post: 2009-04-03, 15:00
  2. (Bluetooth) RSocket Write function does not call RunL function
    By ronald29 in forum Symbian Networking & Messaging (Closed)
    Replies: 13
    Last Post: 2008-10-14, 10:58
  3. how to cut call after dial in python ?
    By AMIT_GOHEL in forum Symbian
    Replies: 9
    Last Post: 2008-10-11, 08:29
  4. call function in DLL
    By freesui1984 in forum Symbian
    Replies: 8
    Last Post: 2008-01-11, 20:38
  5. data call function
    By greenhornx in forum General Development Questions
    Replies: 0
    Last Post: 2004-07-23, 04:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×