On Mon, 29 May 2000, Clint Hepner wrote:

> I'm having a problem adding a GnomeCanvas to a GnomeApp window.
> It seems to me that whatever you add should be centered in the
> window, and the window should be just big enough to contain it.
> However, the canvas item I'm trying to add is in the lower
> righthand corner, and the window starts out not displaying the
> entire canvas. Here is an example:
> 
> from gtk import *
> from gnome.ui import *
> 
> mainwin = GnomeApp('test','test')
> mainwin.set_title('testing')
> mainwin.connect('destroy',mainquit)
> 
> w = 300
> h = 300
> gc = GnomeCanvas()
> gc.set_usize(w,h)
> gc.root().add('rect',x1=0,x2=w,y1=0,y2=h,fill_color='blue',outline_color='white')
> 
> mainwin.set_contents(gc)
> mainwin.show()
> mainloop()
> 
> If the canvas is smaller than about 100x100, it seems to be OK, although the
> canvas still isn't completely centered if the window is resized.
> 
> Is this how GnomeApp is supposed to work, or is it a bug?

When you resize your window, there is more room for the canvas, so it is
allocated more space.  So your rectangle would shift with the corner of
the canvas.  You could connect to the size_allocate signal of the canvas
and set the scroll region appropriately so that the canvas items stay
centred.

> 
> 
> Thanks in advance,
> 
> Clint

James.

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


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to