Re: [pygtk] catching a window resizew event in pygtk2

2003-07-01 Thread Jean-Baptiste Cazier
Sorry for the last e-mail I was answering to somebody else

I have something completly different for you :)

You are right my routine is conflicting with another: 
I have connected to the are_expose_event which function calls for get_allocation.
self.area.connect("expose-event", self.area_expose_cb)

...

def area_expose_cb(self, area, event):
...
  allo = self.area.get_allocation()
...

I suppose that in turn it sends the size_allocation signal.
In this area_expose_cb routine I need to reasd the size of the window in order to draw 
my updated picture with the right size

How can I get around this problem and find my window size without calling for the 
size_allocate event ?


Thanks 

Jean-Baptiste





On Tue, 01 Jul 2003 15:33:56 +0800
James Henstridge <[EMAIL PROTECTED]> wrote:

> Jean-Baptiste Cazier wrote:
> 
> >Sæl !
> >
> >I am porting my code from gtk1 to GTk2, ie pygtk 0.6 to 1.99 (quite painful btw)
> >I am stuck with the resizing manually of the window : everytime I resize the I want 
> >to update the drawing area it contains
> >
> >I used to connect to size_allocate signal in pygtk 0.6
> >window.connect("size_allocate",self.area_resize)
> >
> >But now this has the effect to call self_area_resize constantly
> >
> >So I changed to configure_event, to only call area_resize after changes in sizes, 
> >window.connect("configure_event",self.area_resize)
> >But now the size allocation is not up-to date when I try to read it.
> >What is the correct signal to use in order to perform an operation based on the 
> >size of the window when it is resizing
> >
> >Is there any more simpler way to catch the event that the window size is being 
> >changed by the mouse and obtain the new size ?
> >  
> >
> Connecting to the "size_allocate" is the right thing to do.  The new 
> allocation should be passed as an argument to your handler.  Eg:
> def area_size(self, widget, allocation):
> print allocation.width, 'x', allocation.height
> 
> It shouldn't result in an infinite loop unless you are triggering a 
> resize from your size_allocate handler (which would be a very bad thing 
> to do).
> 
> James.
> 
> -- 
> Email: [EMAIL PROTECTED]
> WWW:   http://www.daa.com.au/~james/
> 
> 
> 


-- 
-
[EMAIL PROTECTED]

Department of Statistics
deCODE genetics Sturlugata,8
570 2993  101 Reykjavík

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] catching a window resizew event in pygtk2

2003-07-01 Thread James Henstridge
Jean-Baptiste Cazier wrote:

Sæl !

I am porting my code from gtk1 to GTk2, ie pygtk 0.6 to 1.99 (quite painful btw)
I am stuck with the resizing manually of the window : everytime I resize the I want to 
update the drawing area it contains
I used to connect to size_allocate signal in pygtk 0.6
window.connect("size_allocate",self.area_resize)
But now this has the effect to call self_area_resize constantly

So I changed to configure_event, to only call area_resize after changes in sizes, 
window.connect("configure_event",self.area_resize)
But now the size allocation is not up-to date when I try to read it.
What is the correct signal to use in order to perform an operation based on the size of the window when it is resizing

Is there any more simpler way to catch the event that the window size is being changed by the mouse and obtain the new size ?
 

Connecting to the "size_allocate" is the right thing to do.  The new 
allocation should be passed as an argument to your handler.  Eg:
   def area_size(self, widget, allocation):
   print allocation.width, 'x', allocation.height

It shouldn't result in an infinite loop unless you are triggering a 
resize from your size_allocate handler (which would be a very bad thing 
to do).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/