Replacement for pygtk?

Grant Edwards grant.b.edwards at gmail.com
Fri Sep 4 17:31:09 EDT 2020


On 2020-09-04, Chris Green <cl at isbd.net> wrote:
> Grant Edwards <grant.b.edwards at gmail.com> wrote:
>> On 2020-09-03, Grant Edwards <grant.b.edwards at gmail.com> wrote:
>> > [...]
>> >
>> > Is pygobject the replacement for pygtk?
>> 
>> It seems to be.  I've started porting my pygtk app, and it's going
>> pretty smoothly.  I've already got my two custom widgets working.
>> Oddly, the main module provided by the gobject package is called "gi".
>> 
> I think the 'i' is for instrospection - GTK Introspection.
>
> FWIW I ported some Python 2 GTK code to Python 3 and it wasn't *too*
> painful.  Run 2to3 on the code and then fix the odd syntax errors that
> remain.

The 2 -> 3 part is usually trivial except for bytes.  I work a lot
with raw data from serial ports and network sockets, and trying to
write programs that worked in both py2 and py3 was painful.  I've
started to abandon py2 support, and that makes it a lot easier.

The only part of the gtk code that didn't translate directly (or
almost so) was some pixbuf stuff.

I'm still trying to figure out to "freeze" the size of a button so
that when I change its contained label text on-the-fly it doesn't
resize and shift everying else slightly.  I don't remember that
happening with gtk2 (which I can no longer run), but I've no idea
why...

--
Grant




More information about the Python-list mailing list