当前位置: 首页>>代码示例>>Python>>正文


Python wx.PostEvent方法代码示例

本文整理汇总了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 
开发者ID:hasegaw,项目名称:IkaLog,代码行数:20,代码来源:preview.py

示例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) 
开发者ID:theRealTacoTime,项目名称:poclbm,代码行数:24,代码来源:guiminer.py

示例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) 
开发者ID:YoRyan,项目名称:nuxhash,代码行数:22,代码来源:benchmarks.py

示例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) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:19,代码来源:DownloadManager.py

示例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) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:20,代码来源:ColourSelectButton.py

示例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) 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:7,代码来源:events.py

示例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) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:30,代码来源:core.py

示例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) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:9,代码来源:wm_legend.py

示例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) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:12,代码来源:wm_core.py

示例10: Repaint

# 需要导入模块: import wx [as 别名]
# 或者: from wx import PostEvent [as 别名]
def Repaint(self):
        self.Refresh()
        wx.PostEvent(self, wx.PaintEvent()) 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:5,代码来源:CardAndReaderTreePanel.py

示例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 
开发者ID:hasegaw,项目名称:IkaLog,代码行数:7,代码来源:preview.py

示例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) 
开发者ID:hasegaw,项目名称:IkaLog,代码行数:5,代码来源:preview.py

示例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 
开发者ID:hasegaw,项目名称:IkaLog,代码行数:40,代码来源:capture.py

示例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) 
开发者ID:hasegaw,项目名称:IkaLog,代码行数:6,代码来源:gui.py

示例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)) 
开发者ID:hschauhan,项目名称:gosync,代码行数:7,代码来源:GoSyncEvents.py


注:本文中的wx.PostEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。