【发布时间】:2011-10-06 12:35:22
【问题描述】:
我有一个窗口 - EditWindow(类的对象,继承 wx.Frame),其中包含 Grid 对象(self.grid)。 在这个类中我写了这个方法:
def OnSubindexGridCellLeftClick( self, event ):
....
dragSource = MyDropSource( self.grid )
dragSource.SetData( data )
dragSource.DoDragDrop()
event.Skip()
并将其绑定到 EditWindow 的 __init__ 中:
self.grid.Bind( wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSubindexGridCellLeftClick )
在另一个窗口 - “VariableWindow”中,我有另一个网格 - “VariablesGrid”,我确定了以下类:
class VariableDropTarget(wx.TextDropTarget):
def __init__(self, parent):
wx.TextDropTarget.__init__(self)
self.ParentWindow = parent
def OnDropText(self, x, y, data):
x, y = self.ParentWindow.VariablesGrid.CalcUnscrolledPosition(x, y)
....
在另一个窗口中我设置了放置目标:
self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
当我从网格(位于 EditorWindow 中)放置光标时,我如何挂钩对象的一些信息 - “VariablesGrid”。我想获取 VariablesGrid 中的数据信息以及 EditWindow 如何接收这些信息? 对不起我的英语不好。
【问题讨论】:
标签: python drag-and-drop wxpython wxwidgets