FloatCanvas events

This might be not the correct group but I see the author of FloatCanvas posting here once and awhile.

If I create a NavCanvas and add some circles to its canvas I am able to detect mouse down events. If I remove the NavCanvas and use a FloatCanvas instead I no longer get the events.

My class uses NavCanvas as its base, all I do is change this to FloatCanvas and change the init names for the base class (and use the canvas directly).

Is there something I need to do when using a FloatCanvas differently? Everything displays ok but i’m not getting the events. Even if i hack the demo for FloatCanvas I am seeing the same thing.

I’m developing on a Mac using the 2.8.9.1 version of wxPython

thanks,

Jamie

···

Jamie McQuay

Scimatic Software Inc.

[www.scimatic.com](http://www.scimatic.com/) 

****We build software for scientists.****

</details>

Jamie McQuay wrote:

This might be not the correct group but I see the author of FloatCanvas posting here once and awhile.

yes, I'm here. You can also ask questions on the FloatCanvas list:

http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

If I create a NavCanvas and add some circles to its canvas I am able to detect mouse down events. If I remove the NavCanvas and use a FloatCanvas instead I no longer get the events.

NavCanvas is simply a panel with a FloatCanvas and a toolbar on it, so it should work the same way.

My class uses NavCanvas as its base, all I do is change this to FloatCanvas and change the __init__ names for the base class (and use the canvas directly).

that should work. I suspect you may be having an issue with the GUImode the Canvas is using -- NavCanvas sets this. I don't have time now to write you a sample, but take a look at the NavCanvas code to see what it does.

You could also post a small sample here or on the FloatCanvas list, and I or someone else will take a look.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Thanks for the reply Chris,

that should work. I suspect you may be having an issue with the GUImode the Canvas is using -- NavCanvas sets this. I don't have time now to write you a sample, but take a look at the NavCanvas code to see what it does.

Tried again with a very simple example (at bottom of post) and it does not work... I'll did into the code to see what the NavCanvas is doing different (as you mentioned above)

You could also post a small sample here or on the FloatCanvas list, and I or someone else will take a look.

The example below works showing the coordinates in the statusbar. If I replace the NavCanvas initialization with:
         Canvas = FloatCanvas. FloatCanvas(self,
                                          size = (500,500),
                                          BackgroundColor = "DARK SLATE BLUE",
                                          )

then the updates are no longer being handled.

Again, i'll dig into the NavCanvas code.

Thanks,

Jamie

import wx
import sys
sys.path.append("../")
from wx.lib.floatcanvas import NavCanvas, FloatCanvas

class DrawFrame(wx.Frame):

     """
     A frame used for the FloatCanvas Demo

     """

     def __init__(self, *args, **kwargs):
         wx.Frame.__init__(self, *args, **kwargs)

         self.CreateStatusBar()

         # Add the Canvas
         Canvas = NavCanvas.NavCanvas(self,
                                          size = (500,500),
                                          BackgroundColor = "DARK SLATE BLUE",
                                          ).Canvas

         self.Canvas = Canvas

         FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove )

         self.Show()
         Canvas.ZoomToBB()

     def OnMove(self, event):
         self.SetStatusText("%.2f, %.2f"%tuple(event.Coords))

if __name__ == '__main__':
     app = wx.App(False)
     F = DrawFrame(None, title="FloatCanvas Demo App", size=(700,700) )
     app.MainLoop()

Thanks for the reply Chris,

that should work. I suspect you may be having an issue with the GUImode the Canvas is using – NavCanvas sets this. I don’t have time now to write you a sample, but take a look at the NavCanvas code to see what it does.

Tried again with a very simple example (at bottom of post) and it does not work… I’ll did into the code to see what the NavCanvas is doing different (as you mentioned above)

If I set the mode in my code (GUIMode.GuiMouse()) then using the FloatCanvas by itself works as expected.

Thanks again Chris for the tip.

Jamie

···

Jamie McQuay

Scimatic Software Inc.

[www.scimatic.com](http://www.scimatic.com/) 

****We build software for scientists.****

</details>

Jamie McQuay wrote:

If I set the mode in my code (GUIMode.GuiMouse()) then using the FloatCanvas by itself works as expected.

I'm glad it's worked out for you.

If you are doing more with it, be sure to join the mailing list -- it's pretty low traffic:

http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

I’m glad it’s worked out for you.

If you are doing more with it, be sure to join the mailing list – it’s pretty low traffic:

http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Hi Chris,

I plan on using the FloatCanvas fairly heavily so i’ll sign up.

Cheers,

Jamie

···

Jamie McQuay

Scimatic Software Inc.

[www.scimatic.com](http://www.scimatic.com/) 

****We build software for scientists.****

</details>