On Tuesday 25 February 2003 17:13, John K Luebs wrote:
> 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
>

Yeah, leave me in suspense. :)

There seems to be a good tutorial which I'll try to read this weekend, but 
mostly I'm just using the old "gtk.py" source code with guesses at how it's 
changed (or delves into the modern C source) when that's not good enough.

> > > 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.

Bog standard Red Hat 8, which is probably broken.  The term's whatever comes 
with KDE.

> > 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.

It's not eating CPU for me here.  It's blocking until it gets an event. I 
stuck in a print to see the return value to prove it.

> > 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.

Okay.  I'm on the road with my laptop for a moment and can't easily test this 
until I get back from Florida next thursday...

> 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?

Red Hat 8.0 comes with 1.99.12, I believe.

> > > 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.

Oh good.  But you still think the event problem is because of that?

I'd upgrade, but compiling this particular toy from source is a pain due to a 
forest of dependencies.  (I'll get around to setting it up properly to 
compile from source eventually, but right now I have other things to 
juggle...)

> --jkl

Rob

-- 
penguicon.sf.net - A combination Linux Expo and Science Fiction Convention, 
May 2-4 2003 in Warren, Michigan. Tutorials, installfest, filk, masquerade...
_______________________________________________
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