--- Begin Message ---
hi Felix
i m writing a personal mail, as my post is not being accepted by mailing list
though i have subscribed to it many times.
i want to ask, how can i access g_signal_connect_* family of APIs from
python
do i need to write a c code that will act as a callback for signal handler, and
in that c code i will call python functions
i mean to say, i have a class which registers certain signals using
g_signal_new
and i have to use g_signal_connect to register a callback function.
Now i am generating python bindings for this class, but i m not sure about
how to register callback functions that will be written in python.
should i provide a wrapper function which will take python object as argument
and will
internally register a dummy signal callback function using g_signal_connect.
this dummy function will than provide a mechanism to call python code from C
code.
ie to say
from python i will call a function as
defs p:
...
...
demo.register_callback(p)
this will call wrapper function register_callback which looks like
static PyObject *
_wrap_register_callback(........)
{
.......
PyArg_ParseTuple(); //----> conversion from python to C
g_signal_connect(..,..,GCALLBACK(dummy),....)
.....
}
and in dummy function i will write the code to call python function "p"
will this be OK or is there any other method
bye
Felix Rabe (public) wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Varun,
>
> varun_shrivastava wrote:
>> hi
>> i m new to pygtk
>> and want to know how its better to use
>> pygtk rather than gtk
>>
>> what r its pros and cons
>
> GTK+:
> Use GTK+ if your programming language is C
> - - It is more cumbersome to program
> + Your application executes faster
>
> PyGTK:
> Use PyGTK if your programming language is Python
> + It is easier (and more fun :) ) to program
> - - Your application executes more slowly
>
> Start out with the programming language you know. Lern GTK+ if you know
> C, or PyGTK if you know Python. If you don't know either C or Python,
> Python is *way* easier to learn than C, but C is also simple enough. I
> learned both (C / GTK+ first).
>
> I personally browse the GTK+ source code (yes, the library's code)
> sometimes to find out "best practise" / some examples / how stuff works.
> But normally you do not need to do this if you just program in PyGTK
> and are not a perfectionist like me. :o)
>
> Greetings,
> Felix
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGcrzLlW86h1QHmOcRAsdVAKDKl+jf1eh2Iw+pZIqyAaHFSArH/QCgm1zP
> fAE8rQzsR3sUNovMVrfsTuo=
> =hdzm
> -----END PGP SIGNATURE-----
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
>
Quoted from: http://www.nabble.com/Pygtk-or-gtk-tf3913322.html#a11143106
--- End Message ---
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/