python - How source object can receive feedback information of object at dropping moment (DataSource)? -
i have 1 window - editwindow ( object of class, inherit wx.frame ), contain grid object (self.grid). in class write method:
def onsubindexgridcellleftclick( self, event ): .... dragsource = mydropsource( self.grid ) dragsource.setdata( data ) dragsource.dodragdrop() event.skip()
and bind in __init__
of editwindow :
self.grid.bind( wx.grid.evt_grid_cell_left_click, self.onsubindexgridcellleftclick )
in window - "variablewindow" have got grid - "variablesgrid" , determine following class:
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) ....
in window set drop target:
self.variablesgrid.setdroptarget(variabledroptarget(self))
how can hook information of object - "variablesgrid" @ moment, when drop cursor grid (which situated in editorwindow). want take information of data in variablesgrid , how editwindow can receive information ? sorry bad english.
you use pubsub send data editorwindow , display it. sending in ondroptext method only sends when drop @ end of drag. here's simple tutorial on pubsub going: http://www.blog.pythonlibrary.org/2010/06/27/wxpython-and-pubsub-a-simple-tutorial/
Comments
Post a Comment