[wxPython] wxOGL and overriding OnDrawContents

Ok. I've managed to draw text to the wxDC and can do a bunch of other neat
stuff. I have some other questions.

1: Text is added to a wxShape via the wxShape::AddText method. How do I
reference this text?

If, instead of this:

    def OnDrawContents(self, dc):
        self.base_OnDrawContents(dc)
        self.UpdateStatusBar(self.GetShape())

I wanted to do this:

    def OnDrawContents(self, dc):
        shape = self.GetShape()
        font = shape.GetFont()
        dc.SetFont(font)
    # GetX/GetY is not the proper text position. I know. I'll get
there.
        dc.DrawText("TEXT", shape.GetX(), shape.GetY())
        self.UpdateStatusBar(shape)

What to I replace "TEXT" with to draw the same text as the call to
self.base_OnDrawContents(dc)

2: In handling OnRightClick for a wxShape, I am trying to create a PopupMenu
over the shape.

The problem is the PopupMenu is displayed way above the mouse - about the
same height as the menubar plus the toolbar. The code below compensates for
scrolling in the wxCanvas, but I am not sure how to adjust for this other
height differences.

    def OnRightClick(self, x, y, *dontcare):
        shape = self.GetShape()
        canvas = shape.GetCanvas()
        frame = self.statbarFrame
        (sx, sy) = canvas.CalcScrolledPosition(x, y)
        frame.PopupMenu(frame.shape_menu, wxPoint(sx, sy))

Thanks for any advice,
Nick

···

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users