Some PseudoDC questions

I have designed an interactive application using PseudoDC and I am quite happy what can be done using PseudoDC. See the attached image.
Let me know in detail what exactly you are designing I may help you getting along with it.

Thanks

Prashant

image.jpg

···

----- Original Message ----
From: roy zinn roy.zinn@gmail.com
To: wxpython-users@lists.wxwidgets.org
Sent: Thursday, August 14, 2008 6:09:48 PM
Subject: [wxpython-users] Some PseudoDC questions

Hi,

I’m using the wx.PseudoDC and i have some questions:

  1. There is the possibility to associate an id to operation. Is it possible to do switch the order of drawing with those id’s?

  2. I draw a “chart” and then i added a vertical line on top of it to use as marker. when i drag this marker it’s disappearing behind the chart. only when i refresh the window i can see it again in the new place, here is part of the code:

#drawing the marker line

def DrawMarker(self, dc):
y = 0
x = self.maxTextWidth - 3
dc.BeginDrawing()
id = wx.NewId()
self.ID_MARKER = id
dc.SetId(id)
dc.SetPen(wx.Pen(“RED”,3))

    dc.DrawLine(x,y, x, y + self.maxHeight)
    r = wx.Rect(x-1,y-1, 2, self.maxTextHeight + 5)
    dc.SetIdBounds(id,r)
    dc.EndDrawing()

def OnMouse(self, event):
global hitradius
if event.LeftDown():
x,y = self.ConvertEventCoords(event)
l = self.pdc.FindObjectsByBBox(x, y)
for id in l:

            if not self.pdc.GetIdGreyedOut(id):
                self.dragid = id
                self.lastpos = (event.GetX(),event.GetY())
                break

elif event.Dragging() or event.LeftUp():
if self.dragid != -1:
x,y = self.lastpos

if self.dragid != self.ID_MARKER:
dx = 0 # Don’t allow drag right/left
dy = event.GetY() - y
else:
dy = 0 # Don’t allow up/down

                dx = event.GetX() - x
            r = self.pdc.GetIdBounds(self.dragid)
            self.pdc.TranslateId(self.dragid, dx, dy)
            r2 = self.pdc.GetIdBounds(self.dragid)

            r = r.Union(r2)
            self.OffsetRect(r)
            self.RefreshRect(r, False)
            self.lastpos = (event.GetX(),event.GetY())
        if event.LeftUp():
            print self.lastpos[1]/(self.maxHeight + 5)

            self.dragid = -1
            self.Refresh()

Thanks,

Roy.