Replacement for pygtk?

Chris Green cl at isbd.net
Sat Sep 5 05:00:35 EDT 2020


Grant Edwards <grant.b.edwards at gmail.com> wrote:
> > The nice thing about the gi module is it can wrap any gobject-based
> > library, not just GTK+ proper.  So if someone made a custom widget
> > in Vala, for example, you could access it via gi.  It's a neat
> > idea. My only problem with it is the resulting Python API is not
> > always as pythonic as pygtk code was.
> 
> I noticed that right away.  In pygtk, most methods (e.g. .pack_start)
> had named arguments with well chosen defaults. The vast majority of
> the time, I only supplied one argument for the pack_start() call.
> With gi's implementation of pack_start, there are no named parameters:
> they're all positional. You have to specify all four of them every
> time, even if the last three are False,False,0 95% of the time.  And
> the lack of names makes it impossible to figure out from reading the
> application source code what those last three actually mean.  [The
> first argument is obvious in context.]
> 
> I assume that difference is because pygtk was hand-written and gi is
> built auto-magically using SWIG or something like that?
> 
In my case a couple of constants/enums changed their names and of
course gtk becomes Gtk in many places.

-- 
Chris Green
·


More information about the Python-list mailing list