python - pygtk window moves when resized -


setup:

  • os: ubuntu precise (12.04) amd64
  • python: 2.7.3
  • gtk: 2.24.0
  • windowmanager: metacity , fvwm2 both exhibit same behavior

i have small pygtk app contains (among other widgets) treeview. window has resizable=false treeview expanded/collapsed, window automatically resizes fit content. works fine.

the problem when window resizes, stays centered on was. want top-left corner of window stay in same spot when window resizes.

i've found calling parse_geometry() +x+y position induce desired behavior. that's not option. in typical case, want window open mouse is, not in fixed location.

i suspect need set gtk.gdk.hint_user_pos, best can tell, pygtk's version of set_geometry_hints() doesn't allow me pass gdkwindowhints c , perl interfaces do.

how can make window's top-left corner stay still contents cause window change size?

update:

since parse_geometry() sets bit me, before gtk.main(), call

gobject.timeout_add(500, self.fix_window) 

the callback is:

def fix_window(self):     self.window.parse_geometry("+%d+%d" % self.window.get_position()) 

while works, it's ugly i'd still appreciate better alternative.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -