[pygtk] "gtk.Window.get_size()" returns wrong dimesntions after "resize()"?
Pietro Battiston
me at pietrobattiston.it
Fri Jan 25 16:04:34 WST 2013
Il giorno gio, 24/01/2013 alle 12.56 +0530, Ajay Garg ha scritto:
>
>
> On Wed, Jan 23, 2013 at 9:58 PM, Guan Xin <guanx.bac a gmail.com> wrote:
> Hi Ajay,
>
> According to
>
> http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--get-size
>
> "As a result, if you call the resize() method then immediately
> call the get_size() method, the size won't have taken effect
> yet. After the window manager processes the resize request,
> PyGTK receives notification that the size has changed via a
> configure event, and the size of the window gets updated."
>
>
> So, perhaps it is expected.
>
>
> Ahh.. Thanks Guan.. !
>
> So, is there a workaround, whereby one get the correct, updated
> dimensions (preferably in a synchronous manner), after "resize" is
> done?
I honestly doubt it's an elegant solution, but years ago I followed this
approach:
http://www.pietrobattiston.it/wiki/pygtk:resizing
best,
Pietro
>
>
>
> Regards,
>
> Guan
>
>
>
> On Wed, Jan 23, 2013 at 5:18 PM, Ajay Garg
> <ajaygargnsit a gmail.com> wrote:
>
> Hi all.
>
>
> First I would like to paste the simplistic example,
> highlighting the issue :
>
> #################################################################
> import gtk
> import gobject
>
> win = gtk.Window()
> win.show()
>
> print win.get_size() # prints (200, 200)
>
> win.resize(100, 346)
> print win.get_size() # still prints (200, 200) :-(
>
> gobject.MainLoop().run()
> #################################################################
>
>
>
>
> As can be seen, the "get_size()" continues printing
> the older dimensions, even after a "resize()" has
> been done?
>
>
> Is it expected? Is there a way I can get "(100, 346)"
> to be printed in the second call to "print
> win.get_size()" ?
> (note that the resizing graphical-effect takes place
> without any issues)
>
>
>
>
> Regards,
> Ajay
>
>
> _______________________________________________
> pygtk mailing list pygtk a daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
>
>
>
>
> --
> Regards,
> Ajay
> _______________________________________________
> pygtk mailing list pygtk a daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
More information about the pygtk
mailing list