Gael Varoquaux a écrit :
On Tue, Aug 30, 2011 at 10:12:09AM +0200, pellegrini wrote:
would you have any idea how to solve this ?
No, I have never seen this.
1. What OS are you on?
2. Do you have a small, self-contained script to reproduce the problem.
G
Hello everybody,
I could finally find a way to solve my problem with right-clicking on a
mayavi scene to use a contextual menu.
As a reminder, my problem was the following. When selecting one item of
the contextual menu, my dialog was frozen and the only way to get the
hand back on it was to right-click another time. To make it work, I
stopped using the add_observer method provided by Mayavi to
mouse/keyboard... interact with the scene and I decided to stay on the
wxPython side using a wx.EVT_CONTEXT_MENU event. It seems to do the job.
For those interested, I join a little script that roughly shows what I
described above.
see you
Eric
--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France
import collections
import copy
import operator
import os
import time
import wx
from enthought.traits.api import HasTraits, Instance, on_trait_change, List, Dict, Int, Array
from enthought.traits.ui.api import View, Item
from enthought.mayavi.sources.api import ArraySource
from enthought.mayavi.modules.api import IsoSurface
from enthought.mayavi.core.ui.api import MlabSceneModel, SceneEditor
from enthought.mayavi import mlab
from enthought.tvtk.api import tvtk
class UniverseViewer(HasTraits):
scene = Instance(MlabSceneModel, (), {'background' : (0,0,0)})
def __init__(self):
HasTraits.__init__(self)
view = View(Item("scene", editor = SceneEditor(), resizable = True, show_label = False), resizable = True)
class UniversePanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent)
self.parent = parent
sizer = wx.BoxSizer(wx.VERTICAL)
self.viewer = UniverseViewer()
self.control = self.viewer.edit_traits(parent=self, kind='subpanel').control
sizer.Add(self.control, 1, wx.ALL|wx.EXPAND, 0)
self.SetSizer(sizer)
self.menu = wx.Menu()
item = self.menu.Append(wx.ID_ANY, "Select all")
self.menu.Bind(wx.EVT_MENU, self.__select_all, item)
self.control.Bind(wx.EVT_CONTEXT_MENU, self.__show_menu)
def __show_menu(self, event):
pos = event.GetPosition()
pos = self.control.ScreenToClient(pos)
self.PopupMenu(self.menu, pos)
def __select_all(self, event=None):
print "toto"
def start_application():
app = wx.App(redirect = False)
f = wx.Frame(None)
c = UniversePanel(f)
f.Show(True)
app.MainLoop()
if __name__ == "__main__":
start_application()
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users