Hi all,
I am working on a little GUI to connect a Novation Launchpad to SooperLooper. I have a basic test app going. Basically a 9x9 grid of panels where you can select colours for each panel. You can select a panel by Ctrl/Cmd left clicking on it, right clicking brings up a context menu where you can select a colour. I am doing this by using PostEvent to forward the mouse events on to the parent panel which then deals with selecting and changing the colours of the right panel:
self.Bind(wx.EVT_RIGHT_DOWN, self.onMouse)
self.Bind(wx.EVT_LEFT_DOWN, self.onMouse)
self.Bind(wx.EVT_MOTION, self.onMouse)
def onMouse(self, event):
wx.PostEvent(self.parent, event)
event.Skip()
and in the parent panel:
self.Bind(wx.EVT_RIGHT_DOWN, self.onRightClick)
self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClick)
self.Bind(wx.EVT_MOTION, self.onMotion)
def onMotion(self, event):
print event.GetId()
def onRightClick(self, event):
self.leds[event.GetId()].select(1)
menu = wx.Menu()
for index,item in enumerate(self.menu_list):
menu.Append(index,item[0])
wx.EVT_MENU(menu, index, self.menuSelection)
self.PopupMenu(menu, self.leds[event.GetId()].GetPosition() + event.GetPosition())
for item in self.leds:
item.select(0)
menu.Destroy()
def onLeftClick(self, event):
if event.CmdDown():
self.leds[event.GetId()].select(3)
I would like to use the EVT_MOTION to select several panels while Ctrl is being pressed but the Id while dragging remains the same as the Id of the panel where dragging began. Is there any way to break free of this?
Full code is here: [https://gist.github.com/2308241](https://gist.github.com/2308241)
Regards,
Kasapr