It should indeed be done like this:

 import gi
 gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk

 from gi.repository import GObject

 mystore = Gtk.ListStore(GObject.TYPE_UINT64)
 mystore.insert_with_valuesv(-1, [1], [GObject.Value(GObject.TYPE_UINT64, 
1330400507426)])

###

I was completely unaware of that possibility because the source of my
GTK knowlege is

https://lazka.github.io/pgi-
docs/#Gtk-3.0/classes/ListStore.html#Gtk.ListStore.set_column_types

When checking out the available types one ends up here:

https://lazka.github.io/pgi-
docs/#GObject-2.0/classes/GType.html#GObject.GType

Which does not ring any bell ...

So I did it like in

https://python-gtk-3-tutorial.readthedocs.io/en/latest/treeview.html
#the-model

where the Python types are used.

###

With the knowlege I gained through this FR it was possible to find this:

GObject Built-in Type Constants
The Built-in Type constants specify the pre-defined types used by gobject.

https://developer.gnome.org/pygobject/stable/gobject-constants.html
#gobject-type-constants

which is quite useful.

###

Thanks!

On 11.03.20 17:56, Christoph Reiter wrote:
>  import gi
>   gi.require_version('Gtk', '3.0')
>   from gi.repository import Gtk
>
>   This works in Python 2:
>
>   mystore = Gtk.ListStore(long)
>   mystore.insert_with_valuesv(-1, [1], [long(1330400507426)])
>
>   This does not work in Python 3:
>
>   mystore = Gtk.ListStore(int)
>   mystore.insert_with_valuesv(-1, [1], [int(1330400507426)])

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1866625

Title:
  OverflowError: With Python 3 Gtk.ListStore only accepts 32 Bit
  Integers.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pygobject/+bug/1866625/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to