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 [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
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 [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: learning gtk - callbacks
greg wolski [EMAIL PROTECTED] wrote: Subject: learning gtk - callbacks Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? This is a little bit confusing because no arguments are indicated in those connections. Thanks for any help, For learning purposes, I humbly suggest Euphoria/GTK. Euphoria is an extremely fast interpreted language, and it, along with the GTK bindings, make creating GTK programs amazingly simple compared to C. There are no makefiles, compiling or linking to do, you just write code and run it. Once you have a better understanding of how GTK works, you will have less trouble writing your programs in C, if you find it necessary. Here are links to documentation, sample code, screenshots, etc: http://databrook.com/users/irvm/ the project itself is hosted at http://sourceforge.net/projects/eugtk Regards, Irv ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_widget_queue_resize() forgetting allocation
For posterity: I isolated the issue to the GtkViewport widget. I found that if I packed the label/vbox into a GtkLayout and packed that into the GtkScrolledWindow, the size negotiations worked the way they should. I don't know if the problem is caused by some function of the viewport that I don't understand, but I'm not going to spend any more time on it. Using a layout works, though it requires a little more massaging. The only problem I have now is that the step_increment field of the vertical GtkAdjustment in the scrolled window doesn't update itself upon resize, and indeed sits at zero. But I can deal with that. On Sun, Sep 19, 2004 at 12:02:48PM -0400, Stephen Bach wrote: stuff ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
GtkLayout and {h,v}adjustment-step_increment
Just a quick question. The gtk_layout_size_allocate() function seems to set the page_increment fields of its layout's GtkAdjustments, but not the step_increment fields. So in, say, gtk_set_hadjustment_values() and gtk_set_vadjustment_values() (called in gtk_viewport_size_allocate()) of gtkviewport.c: ... hadjustment-page_size = view_allocation.width; hadjustment-step_increment = view_allocation.width * 0.1; hadjustment-page_increment = view_allocation.width * 0.9; hadjustment-lower = 0; ... vadjustment-page_size = view_allocation.height; vadjustment-step_increment = view_allocation.height * 0.1; vadjustment-page_increment = view_allocation.height * 0.9; vadjustment-lower = 0; ... But in gtk_layout_size_allocate() of gtklayout.c: ... layout-hadjustment-page_size = allocation-width; layout-hadjustment-page_increment = allocation-width * 0.9; layout-hadjustment-lower = 0; ... layout-vadjustment-page_size = allocation-height; layout-vadjustment-page_increment = allocation-height * 0.9; layout-vadjustment-lower = 0; ... This means that clicking the steppers in the scrollbars for the layout do nothing. In my program I've set step_increment manually by connecting to the allocate signal of the layout, but I'm wondering what the reason is for the missing functionality. Thanks, Stephen ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: learning gtk - callbacks
On Fri, 2004-09-24 at 16:30 -0700, greg wolski wrote: Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? The third argument to g_signal_connect defines which function GTK calls. In your examples G_CALLBACK (delete_event) and G_CALLBACK (destroy) are the third arguments. The G_CALLBACK () is to cast the function pointer to the correct type, the actual functions are called delete_event and destroy, which happens to be the same as the signal names, this is just coincidence you can call them anything you want. I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? No, it is about the functions you pass as the third argument to g_signal_connect. This is a little bit confusing because no arguments are indicated in those connections. The fourth argument to g_signal_connect is a pointer you can use to pass an extra argument to the callback function. The signatures for callback functions depend on the signal type and the object type. These signatures are defined in the API documents. The convention is that the final argument to a callback is a gpointer data which will be the pointer you supply as the fourth argument to g_signal_connect. In your example this is NULL in both cases. Keith. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
How can I load a jpg or png from file to pixmap?
Hello How can I load a jpg or png graphics from file to pixmap in gtk+1.2 duanjf _ Do You Yahoo!? 150MP3 http://music.yisou.com/ http://image.yisou.com 1G1000 http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list