[pygtk] PyGTK GUI for a C programm

Joost Behrends webmaster at h-labahn.de
Sat Feb 23 01:19:55 WST 2008


Hi Jeff,

sorry - this went to a wrong thread on my first dispatch.

Two weeks is not much for a novice to understands GUI programming. Don't be frustrated - 
the principles of events, signals and their connection to the widgets are the same 
in all GUI builders and programming languages. And they are a very telling example 
for the usefulness of classes and inheritance - you learned more than just GUI building.

A long time the connection of C and Python scared me too. 
There are three different problems to solve with that, all of them far from trivial:

- Building dlls, respective shared libraries
- C building systems, especially the Stone Age autoconf and make in GNU 
(filling me with so much disgust, that i even do not like to read 
C sources knowing that i cannot do anything to change them - 
and i am not alone with that)
- the Python C API itself

Since you obviously develop with C, the second problem might be solved by you. 

The Python API is easier than it looks from the first sight. 
There seem to exist no hidden complexities - and if the documentation 
is really complete, it is not so much, 
what has to be learned. But i have very little experience with the C-API.
The only thing i really did so far was, to measure average values 
for the colours over all pixels of a gtk-pixbuf with C 
(which brought an enormous improvement in speed compared to Python).  

There is help for compiling something to a shared library in Python's distutils. 
I also compiled the apsw-interface to sqlite by that and mingw on Windows XP, 
without msys and without any problems. However, in both cases i did not 
embed Python into C but C-binaries into Python, which is a different task.

If i were a C developer and would be comfortable with a C building system 
(but i also do not like VisualStudio), i would not see much advantage in using 
Python for the task you inaugurate. And imho dealing with the problems this poses 
is not very instructive for beginners - and possibly too difficult.

Good luck, Joost Behrends
 


More information about the pygtk mailing list