本文整理汇总了Python中wx.PostEvent方法的典型用法代码示例。如果您正苦于以下问题:Python wx.PostEvent方法的具体用法?Python wx.PostEvent怎么用?Python wx.PostEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.PostEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_button_click
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_button_click(self, event):
file_path = self.text_ctrl.GetValue()
if self.should_open_file(file_path):
evt = InputFileAddedEvent(input_file=file_path)
wx.PostEvent(self, evt)
self.prev_file_path = file_path
self.update_button_label()
return
# file_path is invalid. Open a file dialog.
file_dialog = wx.FileDialog(self, _('Select a video file'))
if file_dialog.ShowModal() != wx.ID_OK:
return
file_path = file_dialog.GetPath()
self.text_ctrl.SetValue(file_path)
# Callback from wx.FileDropTarget.OnDropFiles
示例2: run
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def run(self):
logger.info(_('Listener for "%s" started') % self.parent_name)
while not self.shutdown_event.is_set():
line = self.miner.stdout.readline().strip()
# logger.debug("Line: %s", line)
if not line: continue
for s, event_func in self.LINES: # Use self to allow subclassing
match = re.search(s, line, flags=re.I)
if match is not None:
event = event_func(match)
if event is not None:
wx.PostEvent(self.parent, event)
break
else:
# Possible error or new message, just pipe it through
event = UpdateStatusEvent(text=line)
logger.info(_('Listener for "%(name)s": %(line)s'),
dict(name=self.parent_name, line=line))
wx.PostEvent(self.parent, event)
logger.info(_('Listener for "%s" shutting down'), self.parent_name)
示例3: _OnUnfocus
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def _OnUnfocus(self, event):
speeds = []
speedsRe = r' *[;,]? *(\d+\.?\d*) *([EePpTtGgMmkK](?:H|H/s)?|(?:H|H/s))'
for match in re.finditer(speedsRe, self.GetValue()):
factor = {
'E': 1e18,
'P': 1e15,
'T': 1e12,
'G': 1e9,
'M': 1e6,
'K': 1e3,
'H': 1
}
value = float(match[1])
unit = match[2][0].upper()
speeds.append(value*factor[unit])
event = InputSpeedsEvent(speeds=speeds, id=wx.ID_ANY)
event.SetEventObject(self)
wx.PostEvent(self, event)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def __init__(self, parent, default_text, visit_url_func):
wx.TextCtrl.__init__(self, parent, size=(150,-1), style=wx.TE_PROCESS_ENTER|wx.TE_RICH)
self.default_text = default_text
self.visit_url_func = visit_url_func
self.reset_text(force=True)
self._task = TaskSingleton()
event = wx.SizeEvent((150, -1), self.GetId())
wx.PostEvent(self, event)
self.old = self.GetValue()
self.Bind(wx.EVT_TEXT, self.begin_edit)
self.Bind(wx.EVT_SET_FOCUS, self.begin_edit)
def focus_lost(event):
gui_wrap(self.reset_text)
self.Bind(wx.EVT_KILL_FOCUS, focus_lost)
self.Bind(wx.EVT_TEXT_ENTER, self.search)
示例5: OnButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def OnButton(self, event):
colourData = wx.ColourData()
colourData.SetChooseFull(True)
colourData.SetColour(self.value)
for i, colour in enumerate(eg.config.colourPickerCustomColours):
colourData.SetCustomColour(i, colour)
dialog = wx.ColourDialog(self.GetParent(), colourData)
dialog.SetTitle(self.title)
if dialog.ShowModal() == wx.ID_OK:
colourData = dialog.GetColourData()
self.SetValue(colourData.GetColour().Get())
event.Skip()
eg.config.colourPickerCustomColours = [
colourData.GetCustomColour(i).Get() for i in range(16)
]
dialog.Destroy()
evt = eg.ValueChangedEvent(self.GetId(), value = self.value)
wx.PostEvent(self, evt)
示例6: post_event
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def post_event(destination, event):
if isinstance(destination, Queue.Queue):
destination.put(event)
elif isinstance(destination, wx.EvtHandler):
wx.PostEvent(destination, event)
示例7: CallAfter
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def CallAfter(callableObj, *args, **kw):
"""
Call the specified function after the current and pending event
handlers have been completed. This is also good for making GUI
method calls from non-GUI threads. Any extra positional or
keyword args are passed on to the callable when it is called.
:param PyObject callableObj: the callable object
:param args: arguments to be passed to the callable object
:param kw: keywords to be passed to the callable object
.. seealso::
:class:`CallLater`
"""
assert callable(callableObj), "callableObj is not callable"
app = wx.GetApp()
assert app is not None, 'No wx.App created yet'
if not hasattr(app, "_CallAfterId"):
app._CallAfterId = wx.NewEventType()
app.Connect(-1, -1, app._CallAfterId,
lambda event: event.callable(*event.args, **event.kw) )
evt = wx.PyEvent()
evt.SetEventType(app._CallAfterId)
evt.callable = callableObj
evt.args = args
evt.kw = kw
wx.PostEvent(app, evt)
示例8: on_color_pick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_color_pick(self, event):
"""Recreate the {label: color} dict and send to the parent."""
# print(event.GetId())
self.colors[event.GetId()] = event.GetValue().Get()
self.create_color_dict()
# Send the event to the parent:
wx.PostEvent(self.parent, event)
示例9: on_mouse_left_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_mouse_left_down(self, event):
"""Start making the zoom-to-box box."""
# print("Left mouse down!")
# pcoord = event.GetPosition()
# wcoord = self.canvas.PixelToWorld(pcoord)
# string = "Pixel Coord = {} \tWorld Coord = {}"
# print(string.format(pcoord, wcoord))
# TODO: Look into what I was doing here. Why no 'self' on parent?
parent = wx.GetTopLevelParent(self)
wx.PostEvent(self.parent, event)
示例10: Repaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def Repaint(self):
self.Refresh()
wx.PostEvent(self, wx.PaintEvent())
示例11: on_preview_click
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_preview_click(self, event):
evt = IkalogPauseEvent(pause=(not self._pause))
wx.PostEvent(self, evt)
# wx event
示例12: on_input_file_added
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_input_file_added(self, event):
# Propagate the event to the upper level.
wx.PostEvent(self, event)
示例13: initialize_input
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def initialize_input(self):
print('----------------')
print(self.source, self.source_device)
if self.capture:
# Send a signal to exit the waiting loop.
self.capture.put_source_file(None)
if self.source == 'dshow_capture':
self.capture = inputs.DirectShow()
self.capture.select_source(name=self.source_device)
elif self.source == 'opencv_capture':
self.capture = inputs.CVCapture()
self.capture.select_source(name=self.source_device)
elif self.source == 'screen':
self.capture = inputs.ScreenCapture()
img = self.capture.capture_screen()
if img is not None:
self.capture.auto_calibrate(img)
elif self.source == 'amarec':
self.capture = inputs.DirectShow()
self.capture.select_source(name=self.DEV_AMAREC)
elif self.source == 'file':
self.capture = inputs.CVFile()
# ToDo reset context['engine']['msec']
success = (self.capture is not None)
if success:
self.capture.set_frame_rate(10)
evt = InputInitializedEvent(source=self.source)
wx.PostEvent(self.panel, evt)
return success
示例14: on_ikalog_pause
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def on_ikalog_pause(self, event):
self.engine.pause(event.pause)
# Propagate the event as the top level event.
wx.PostEvent(self.frame, event)
示例15: PostEvent
# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def PostEvent(self, event, data):
if self._sync_listeners[event] and \
self._sync_listeners[event]:
for listener in self._sync_listeners[event]:
wx.PostEvent(listener, GoSyncEvent(self._sync_events[event], data))