Jan Vorcak
Jan Vorcak

Reputation: 19989

Troubles converting code to Gtk3

I'd like to rewrite a gtk python library to Gtk3 (gi.repository) I'd like to ask you what does it include?

For instance library contained contructions like this

gtk.gdk.Cursor(gtk.gdk.TOP_LEFT_CORNER),
gtk.gdk.Cursor(gtk.gdk.TOP_RIGHT_CORNER),
gtk.gdk.Cursor(gtk.gdk.BOTTOM_RIGHT_CORNER),
gtk.gdk.Cursor(gtk.gdk.BOTTOM_LEFT_CORNER) )

so I rewrote it to this

Gdk.Cursor(Gdk.CursorType.TOP_LEFT_CORNER),
Gdk.Cursor(Gdk.CursorType.TOP_RIGHT_CORNER),
Gdk.Cursor(Gdk.CursorType.BOTTOM_RIGHT_CORNER),
Gdk.Cursor(Gdk.CursorType.BOTTOM_LEFT_CORNER) )

So basically what I did was that I opened ipython and google, and was guessing :/

My questions:

  1. Is there somewhere some kind of list? What was replaced and where can I find given class/constant in a gi.repository? For instance I'd like to rewrite gtk.CAN_FOCUS, but I have no idea where do I find such constant in gi.repository
  2. Am I doing it right?
  3. If so, is there something I forgot to do?

Can somebody please explain, why was this change done? gtk2->gtk3, why just not upgrade old libraries? And what does it include if I want to rewrite app for gtk3?

Upvotes: 0

Views: 709

Answers (2)

Oly
Oly

Reputation: 379

For anyone who finds this in the future you can set this flag with this property.

drawing_area.set_property('can-focus', True)

Upvotes: 1

Has QUIT--Anony-Mousse
Has QUIT--Anony-Mousse

Reputation: 77454

Try this in interactive Python:

from gi.repository import Gtk
dir(Gtk)

Upvotes: 0

Related Questions