[wxPython] Getting a DC on a button?

wxGTK 2.1 snap 9
wxPython 2.1b3

I have a class that inherits from wxButton. I'm capturing OnClick events
via the EVT_BUTTON() callback. In my OnClick() I want to get a DC for the
button and draw on it. I call dc = wxWindowDC(self); and python
immediately coredumps. Creating a wxClientDC() also coredumps python.
How do I go about getting a DC so that I can draw on my button?

      &y

···

_______________________________________________
wxPython-users maillist - wxPython-users@starship.python.net
http://starship.python.net/mailman/listinfo/wxpython-users

I have a class that inherits from wxButton. I'm capturing OnClick events
via the EVT_BUTTON() callback. In my OnClick() I want to get a DC for the
button and draw on it. I call dc = wxWindowDC(self); and python
immediately coredumps. Creating a wxClientDC() also coredumps python.
How do I go about getting a DC so that I can draw on my button?

The debugging version of wxGTK has an assert that gets triggered: "DC needs
a widget"

I'll ask about this on wxwin-developers. Incedentally, it works okay on
wxMSW although the button is repainted loosing my lines as soon as the focus
moves:

        size = self.testBtn.GetSize()
        dc = wxClientDC(self.testBtn)
        dc.DrawLine(0,0, size.width, size.height)
        dc.DrawLine(0,size.height, size.width, 0)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com

wxPython has moved Check it out!

_______________________________________________
wxPython-users maillist - wxPython-users@starship.python.net
http://starship.python.net/mailman/listinfo/wxpython-users