[pygtk] "gtk.Window.get_size()" returns wrong dimesntions after "resize()"?

Ajay Garg ajaygargnsit at gmail.com
Thu Jan 24 15:26:27 WST 2013


On Wed, Jan 23, 2013 at 9:58 PM, Guan Xin <guanx.bac at 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?


>
> Regards,
> Guan
>
>
> On Wed, Jan 23, 2013 at 5:18 PM, Ajay Garg <ajaygargnsit at 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 at daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>
>
>


-- 
Regards,
Ajay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20130124/246c9a40/attachment.html>


More information about the pygtk mailing list