I try to port my pygtk code to gtk3. I get this error:
TypeError: pack_start() takes exactly 5 argument(s) (2 given)
It seams that the default arguments have been removed.
Does gtk3 (accessed from python) not support default arguments?
Since the app is not big, I ask myself if I should port to gtk3 or pyside ...
Removing the default arguments looks like a pointless "job creation programm" for programmers...
I could not find a good porting guide (pygtk to python-gtk3). Only this:
Code like this is ugly:
box.pack_start(widget, True, True, 0)
I know how to search+replace .... but I don't want to.
There are two options that I can suggest. One is you use the pygtkcompat compability module. This is probably not a good long term solution though.
The other option is to patch just the pack_start
method in the same way the compatbility module does. Something like this:
orig_pack_start = Gtk.Box.pack_start
def pack_start(self, child, expand=True, fill=True, padding=0):
orig_pack_start(self, child, expand, fill, padding)
Gtk.Box.pack_start = pack_start
This assumes you only want to patch one or two methods. More than that and it's probably better to stick with the compatibility module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With