On Tue, Feb 25, 2003 at 02:04:36PM -0500, Rob Landley wrote:
> On Tuesday 25 February 2003 02:04, John K Luebs wrote:
> > How do you know the wrapper doesn't make sense if you couldn't get it
> > to work? Most of the C idioms used in GTK are mapped to their Python
> > equivalent idiom. Overall, PyGTK has a pretty good setup.
> 
> What is the python equivalent idiom of call by reference?  
> (blah.get_coords([x],[y]) is a straighter translation, but 
> (x,y)=blah.get_coords() seems more pythonic, somehow...)
> 

What I was trying to say is that PyGTK maps most of the GTK API
using Pythonic idioms. In order to use PyGTK you are in the same
position as one trying to use wxWindows. The REAL documentation for
PyGTK is really the 

> > You must create a mainloop, by calling gtk.mainloop().
> 
> "gtk.mainloop()" won't let you ctrl-c out of the program at the console it was

I don't exhibit this behavior. I'm using rxvt, but it doesn't seem like
that should matter. The Ctrl-C invokes the Python internal signal
handler, which is undisturbed by gtk.

> away from elsewhere.  (Which just highlights that I have no CLUE what the 
> return value from gtk.mainiteration is supposed to mean, in the GUI toolkits 
> I know on other platforms, 0 means end of mainloop...)

gtk.mainiteration() runs a single iteration of the mainloop. It returns
whether or not an event was dispatched.

> 
> Probably there are very important reasons not to do this.  I'd love to know 
> what they are...

The long and short of it is that you must create a mainloop. GTK will
not work correctly if you fail to do this. In your case get_coords
was not working properly because your signal handler wasn't even being
invoked.

Unfortunately, I can't replicate your Ctrl-C problem with PyGTK 1.99.15
running in an xterm.
What version of PyGTK are you using? 

> 
> > This is unacceptable because it will suck the
> > life very quickly out of any battery powered device (laptop users will
> > hate you). It also is unnecessarily unfair to lower priority processes.
> 
> I'm running it on a laptop.  My desktop machine is 1500 miles away in Austin.
> 

Well I made a mistake on this one.  gtk_main_iteration is
gtk_main_iteration_do with block=TRUE, so it won't spin.

--jkl
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to