| Hi All, I have some initial ctypes bindings for gtk that work in both python2 and 3. I haven't tested it to the point of opening a window, because i am not familiar with the C API of GTK. I am able to load the lib and call a few functions, so i think its working it just needs the proper startup, maybe somebody can help correcting testgtk.py so it can open a hello-world window. This was tested on ubuntu 10.10, it should work on any platform if you change the location of 'libgtk....so' to point to where your OS has it (you can also point it to _gtk.so from the pygtk package, seems to work the same). -brett |
Is there a particular scenario where this would be a better choice
than using the PyGTK bindings? Or is this just intended to be a test
case for the RPythonic wrapper generator?
I'd look at http://zetcode.com/tutorials/gtktutorial/firstprograms/
for some simple C programs to translate - the first example (just show
a window) is 4 function calls.
_______________________________________________
pygtk mailing list py...@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
| Its more than just a test case for RPythonic. PyGTK is compiled, so it becomes an issue when used from Python embedded inside Blender, also Blender is using Python3 and i'm not sure what the status is of PyGTK with Python3, is it already working? I found the tutorial thanks, got hello world running, next step python callbacks. -brett from _ctypes_gtk import * gtk_init( ctypes.byref( ctypes.c_int(0) ), ctypes.byref( ctypes.pointer( ctypes.c_char_p(''))) ) winwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL) win = ctypes.cast( winwidget, ctypes.POINTER(GtkWindow)
) gtk_window_set_title(win, "ctypes pygtk") gtk_window_set_default_size(win, 320, 240) gtk_signal_connect_full( ctypes.cast(win,ctypes.POINTER(GtkObject)), "destroy", gtk_main_quit, None, None, None, ctypes.c_int(0), ctypes.c_int(0) ) frame = gtk_frame_new('hello world') gtk_container_add( ctypes.cast(win, ctypes.POINTER(GtkContainer)), ctypes.cast(frame, ctypes.POINTER(GtkWidget)) ) gtk_widget_show_all( winwidget
) gtk_main() print('exit') |
My understanding is that PyGObject bindings (created via
introspection) are targeted for Python 3.x and are working well. PyGTK
is basically in maintenance mode for the 2.x series and will not be
updated for GTK 3.
I however do not know what the status is with regards to GTK 2.x/Python 2.x.
http://live.gnome.org/PyGObject