Re: How to get and set the width/height of a label?



I don't know python, but in the example below, the purpose of the line "memset(&l_req,0,sizeof(GtkRequisition));" wat to garantee that the final value of  the members of "l_req" were assigned by "gtk_widget_size_request". I mean, that is no a required step, it is relevant only in the example's context.

Atentamente,

Jorge Opaso Pazos
AUTOLogic LTDA




El 07-08-2009, a las 7:05, Gerald Britton escribió:

Does the Python wrapper implement the __sizeof__ special method?  For built-in objects, this is the normal way to get the size.

On Thu, Aug 6, 2009 at 10:43 PM, Jorge Opaso Pazos <jorge opaso gmail com> wrote:
This works (C):

int main(int a_argc,char **a_argv)
{
GtkWidget *l_label;
GtkRequisition l_req;

gtk_init(&a_argc,&a_argv);

l_label = gtk_label_new("hello");
memset(&l_req,0,sizeof(GtkRequisition));
gtk_widget_size_request(l_label,&l_req); // not gtk_widget_get_size_request

printf("%d %d\n",l_req.width,l_req.height);

return 0;
}

Output: 31 17

Maybe in python is: gtk.Label.size_request() 

Atentamente,

Jorge Opaso Pazos
AUTOLogic LTDA




El 06-08-2009, a las 21:33, cbx escribió:

I would like to know how to get and set the size of a label.
There seems no answer in the pygtk API(me using Python currently). gtk.Label.get_size_request() only return (-1,-1).
Google doesn't give much information too. _______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


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




--
Gerald Britton



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