I want to pick a point on a plot and use the x,y of that point to
place a wxPopupWindow
right near that point on the graph. I am doing this in wxPython as an embedded
graph). I have it working *somewhat* but there is still a major
problem with it.
I tried to base this off the wxPython demos wxPopupWindow code, but somehow
it is not working right.
Before I post any code or if I can get a runnable sample going, does anyone
have a pointer to a simple solution? I can get x and y in pixel space on the
graph from event.mouseevent.x and event.mouseevent.y, but then when I try
to sort of add those to the position of the frame which contains the panel
(which contains the graph), I get some really weird behavior when I move that
frame to the left: the location of the popupwindow jumps to the far right side
of the screen.
Warning: the following is based on MPL 0.90.1 (yeah, I know, but it
works. We have a branch that works with 0.98 but it hasn't been merge
back in. Your mileage may vary.)
Our popup code does:
(note that in the bit below, self is a subclassed object based on
FigureCanvasWxAgg)
mouseLocation = wx.GetMousePosition()
pos = self.ScreenToClient(mouseLocation)
height = self.figure.bbox.height()
x = pos.x
y = height - pos.y
(pickType, pickDetails) = self._pick(x,y) # NB: This is a custom pick
routine written before the new pick code
I want to pick a point on a plot and use the x,y of that point to
place a wxPopupWindow
right near that point on the graph. I am doing this in wxPython as an embedded
graph). I have it working *somewhat* but there is still a major
problem with it.
I tried to base this off the wxPython demos wxPopupWindow code, but somehow
it is not working right.