Re: Stack order and raise_



Alessandro Dentella wrote:

I believe you're complicating matters by using groups. I don't think you can raise the child of a group to a higher drawing order than the parent group itself (think depth-first traversal of a tree).

I'm not sure why you have those two groups. Are they there for a reason? Either add both objects directly to the root group, or raise one group above the other, or place both objects in the same group.
Hi,

I have problems with raise_(None). From the docs I read:

  def raise_(above)
above : the item to raise item above, or NULL to raise item to the top of the stack.


if I use None, nothing happens, the yellow rectangle of the example below
doesn't raise it's position.
If I set raise_(r2) I get goocanvas critical error:

  GooCanvas-CRITICAL **: goo_canvas_item_raise: assertion `above_pos != -1' failed


The code I'm using is::

   import gtk
   import goocanvas as goo

   w = gtk.Window()
   c = goo.Canvas()
   w.add(c)

   root = c.get_root_item()

   g1 = goo.Group(parent=root)
   g2 = goo.Group(parent=root)

   r1 = goo.Rect(parent=g1, width=100, height=100,
		 fill_color='gray80', stroke_color='gray80')
   r2 = goo.Rect(parent=g2, width=100, height=100,
		 fill_color='gray90', stroke_color='gray90', x=100)

   r1_1 = goo.Rect(parent=g1, width=100, height=100, fill_color='yellow', x=50)
   #r1_1.raise_(None)
   r1_1.raise_(r2)

   w.resize(220,120)
   w.show_all()

   gtk.main()

Is there some limit that is not written in the docs?

sandro




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