Re: How do i connect C callbacks to Python scripts ?



I'd be inclined to use pygtk for your gui -- this will allow you to have all your code in python (if i understand correctly the only C code you have is the stuff from glade).

There is an excellent pygtk faq here:  http://www.async.com.br/faq/pygtk/index.py?req=index

There is an excellent reference to pygtk here:
http://www.pygtk.org/pygtk2reference/

The best (only?) way to work with glade and pygtk is to use libglade to use the glade xml to create a gui directly.   All you have to do for that is:

class App(object):
   def  __init__(self)
       import gtk
       glade='the_xml_file_you_build_with_glade.glade')
       xml = gtk.glade.XML(glade)
       xml.signal_autoconnect()
       gtk.main()

and just make your callbacks methods for the App object.  The signal_autoconnect thing is smart --- looks for methods which match the ones you defined via glade.

You will also find that writing pygtk code directly (and leaving out glade altogether) is very easy once you get going.

John

saurabh wagh wrote:
How do i connect C callbacks to Python scripts ?

Hey there...

I m a newbie in linux... and am designing an interface for my project ... I
ve used Glade for the same and the code generated is in C...

I ve got some python scripts which i have to use as callbacks...The callback
functions are all in the C code... and I gotta link those to my python
script actions...  Is there any way i can do that ??

Please reply....

                                                        Saurabh Wagh

_________________________________________________________________
Seized by wanderlust? http://www.msn.co.in/Travel/ Have the best vacation
ever.

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]