[Fwd: Re: How to get the the current size of a widget?]



Luis 

If you look at the GtkWidget structure you will find it contains an
GtkAllocation  allocation, which is a simple rectangle.  It is set to
the widget's current size by the configure or realize event of all
widgets.  You can use its value reliably almost anytime after the
gtk_main() has had an opportunity to run and start processing
events/messages.

example:
widget->allocation.x
widget->allocation.y
widget->allocation.width
widget->allocation.height

http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkAllocation

James,
-------- Forwarded Message --------

From: Luis Menina <liberforce fr st>
To: heavenscape <masonduan1 sina com>
Cc: gtk-app-devel-list gnome org
Subject: Re: How to get the the current size of a widget?
Date: Fri, 02 Jun 2006 23:12:58 +0200


Use the "configure-event" event...

It's not well documented in GTK doc:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-configure-event

But the pygtk help tells it's called when the window changes its size
http://pygtk.org/pygtk2reference/class-gtkwidget.html#signal-gtkwidget--configure-event

Cheers

Luis

heavenscape a Ãcrit :
I am displaying a image in my main window, and I want it to automatically
resize with the main window. Can anyone tell me how to get the current size
of the main window or any widget from within a callback?

Regards!
--
View this message in context: 
http://www.nabble.com/How-to-get-the-the-current-size-of-a-widget--t1721682.html#a4676723
Sent from the Gtk+ - Apps Dev forum at Nabble.com.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]