1

Every time I try to set the gravity of my application, it keeps throwing an error message like this: AttributeError: 'gi.repository.Gdk' object has no attribute 'GRAVITY_SOUTH_EAST'

What is the correct method for setting the gravity of a GTK3 application with python? (Not pygtk, I'm using the newer PyGI libraries.)

There isn't a documentation for PyGI AFAIK, and when I do help(Gdk.Gravity) in the python console it returns GDK_GRAVITY_SOUTH_EAST as an option.

imyxh
  • 164
  • 10
  • Is this what you need? https://lazka.github.io/pgi-docs/#Gdk-3.0/enums.html#Gdk.Gravity It looks like it's SOUTH_EAST, but not GRAVITY_SOUTH_EAST. – Chong Tang Jul 01 '16 at 22:11
  • @ChongTang Wow, I had no idea a documentation like that existed. It still doesn't work though, no matter if I do `Gdk.SOUTH_EAST` or just `SOUTH_EAST`. Still throws a "not defined" error. – imyxh Jul 01 '16 at 23:59
  • So did you try `GDK_GRAVITY_SOUTH_EAST`? Could you also post your code? I don't use Python, so I'm not used to how you implement gravity in Python. – oldtechaa Jul 02 '16 at 00:15
  • @oldtechaa Yeah, I tried that. Here's the line of code: `self.set_gravity(self, Gdk.SOUTH_EAST)` I keep substituting Gdk.SOUTH_EAST with similar code but the console never recognizes it. – imyxh Jul 02 '16 at 17:47
  • 1
    Did you look at [this](https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Window.html#Gtk.Window.set_gravity)? It looks like you should be doing `self.set_gravity(Gdk.Gravity.SOUTH_EAST)`. If this works I'll post as an answer. – oldtechaa Jul 02 '16 at 18:07
  • @oldtechaa Nope. It doesn't throw an error, but when I use self.move(200, 200) or even let it be it counts gravity from the northwest. – imyxh Jul 04 '16 at 20:12

0 Answers0