On Tue, Sep 23, 2008 at 3:28 PM, C M <[EMAIL PROTECTED]> wrote:
> I'm hoping to get help from matplotlib wxPython backend users...
>
> I'm struggling to get what is described in the subject line to work correctly.
> There was a sort of similar thread from 2006 here:
>
> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00945.html
>
> 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.

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

....

self.popup = ProbePopupWindow(self, wx.SIMPLE_BORDER,
series.getName(), mouseLocation)

where ProbePopupWindow is a subclass of wx.PopupWindow, and the
positioning bit in the __init__ is:

self.Position(mouseLocation, (10,10))

HTH,
Anthony.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to