GTK Referenc

lf11 at deletethistomailme.andonet.com lf11 at deletethistomailme.andonet.com
Tue Apr 4 16:39:41 EDT 2000


In article <m2snx4utnn.fsf at pchoel.privat.uni-hamburg.de>, 
bhoel at starship.python.net (Berthold Höllmann) wrote:
> Penpal International <ppi at searchy.net> writes:
> 
>> I couldn't find anywhere a reference for the GTK module for Python. Does
>> anyone know one?
>> On gtk's site I could only find some for C(++).
> 
I don't know how experienced you are with Python.  I started playing 
with PyGTK, having absolutely no previous experience with Python.  
That method of learned is Not Recommended.

If you 'import gtk' instead of 'from gtk import *', you will import the 
complete function names.  The syntax of this is _very_similar_ to C GTK.  
In fact, it's almost identical.

Example with 'import gtk' (looks like C)
button = gtk_button_new_with_label('Button')

Example with 'from gtk import *' (faster to type, more Python-ish)
button = GtkButton('Button')

Both do the same thing.  I would recommend using 'import gtk' until you 
know more about it.  Since the syntax is so similar between Python and C, 
I simply use the C GTK reference from www.gtk.org.

A bunch of examples come with PyGTK, notably "testgtk.py".  I learned 
a lot (and am learning a lot) from that script.

Hope this helps,

 -lf



More information about the Python-list mailing list