def fdir_dialogue(self, event):
fdir = "" # Use folder as a flag
currentdir = self.dirchooser.textctrl.GetValue()
dlg = wx.DirDialog(self, defaultPath = currentdir)
if dlg.ShowModal() == wx.ID_OK:
fdir = dlg.GetPath() + "/"
dlg.SetPath(fdir)
dlg.Destroy() # best to do this sooner than later
if fdir:
self.dirchooser.textctrl.SetValue(fdir)
event = wx.PyCommandEvent(wx.EVT_TEXT_ENTER.typeId,
self.dirchooser.textctrl.GetId())
self.GetEventHandler().ProcessEvent(event)
self.fdir = fdir
python类PyCommandEvent()的实例源码
def __init__(self, func, onSuccess, onFailure, *params, **kwparams):
wx.PyCommandEvent.__init__(self, wxEVT_RESPONSE, 1)
self.func = func
self.onSuccess = onSuccess
self.onFailure = onFailure
self.params = params
self.kwparams = kwparams
def swap(self, i, j):
self.index_mapping[i], self.index_mapping[j] = self.index_mapping[j], self.index_mapping[i]
self.SetString(i, self.data[self.index_mapping[i]])
self.SetString(j, self.data[self.index_mapping[j]])
self.selected_items[i], self.selected_items[j] = self.selected_items[j], self.selected_items[i]
# self.update_selection()
# print("Updated mapping:", self.index_mapping)
new_event = wx.PyCommandEvent(wx.EVT_LISTBOX.typeId, self.GetId())
self.GetEventHandler().ProcessEvent(new_event)
def __init__(self, eventType, eventId=1, sel=-1, oldsel=-1):
"""
Default class constructor.
:param `eventType`: the event type;
:param `eventId`: the event identifier;
:param `sel`: the current selection;
:param `oldsel`: the old selection.
"""
wx.PyCommandEvent.__init__(self, eventType, eventId)
self._eventType = eventType
self._sel = sel
self._oldsel = oldsel
self._allowed = True
def __init__(self, choice, id=wx.ID_ANY):
wx.PyCommandEvent.__init__(self, id=id,
eventType=wxEVT_PIEMENU_SELECT)
self.choice = choice
def __init__(self,message):
wx.PyCommandEvent.__init__(self, myEVT_PRINT, wx.ID_ANY)
self._message = message
def __init__(self, etype, eid, value=None):
"""Creates the event object"""
wx.PyCommandEvent.__init__(self, etype, eid)
self._value = value
print 'EVIDENCELOADED EVENT'
def post_string_event(self, eventtype, eventval, panel):
"""
Triggers an event
"""
event = wx.PyCommandEvent(eventtype.typeId, panel.GetId())
event.SetString(str(eventval))
wx.PostEvent(self.GetEventHandler(),event)
def post_slide_event(self,eventval):
"""
Updated positions triggers an
event to let the parent know scroll
position has been changed
"""
event = wx.PyCommandEvent(wx.EVT_COMMAND_SCROLL_CHANGED.typeId, self.GetId())
event.SetInt(eventval)
wx.PostEvent(self.GetEventHandler(),event)
def __init__(self, windowID, data):
wx.PyCommandEvent.__init__(self, self.eventType, windowID)
self.data = data
def __init__(self, windowID, data):
wx.PyCommandEvent.__init__(self, self.eventType, windowID)
self.data = data
def __init__(self, type=wx.wxEVT_NULL, splitter=None):
wx.PyCommandEvent.__init__(self, type)
if splitter:
self.SetEventObject(splitter)
self.SetId(splitter.GetId())
self.sashIdx = -1
self.sashPos = -1
self.isAllowed = True