Python wx.PostEvent() Examples
The following are 30
code examples of wx.PostEvent().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: benchmarks.py From nuxhash with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
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)
Example #3
Source File: preview.py From IkaLog with Apache License 2.0 | 6 votes |
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
Example #4
Source File: ColourSelectButton.py From EventGhost with GNU General Public License v2.0 | 6 votes |
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)
Example #5
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnSelect(self, event): self.sel = event.GetIndex() evt = eg.ValueChangedEvent(self.id, value = self) wx.PostEvent(self, evt) event.Skip()
Example #7
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def CallAfter(self, callable, *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. """ # append (right) and pop (left) are atomic self.event_queue.append((callable, args, kw)) wx.PostEvent(self, self.evt)
Example #8
Source File: spigui.py From spidriver with BSD 3-Clause "New" or "Revised" License | 5 votes |
def ping_thr(win): while True: wx.PostEvent(win, PingEvent()) time.sleep(1)
Example #9
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 5 votes |
def SendSelectorEvent(self, box): if (isinstance(box, wx.CheckBox)): # I have the feeling that this is the wrong way to trigger # an event. newevent = wx.CommandEvent(wx.EVT_CHECKBOX.evtType[0]) newevent.SetEventObject(box) wx.PostEvent(box, newevent) if (isinstance(box, wx.RadioButton)): newevent = wx.CommandEvent(wx.EVT_RADIOBUTTON.evtType[0]) newevent.SetEventObject(box) wx.PostEvent(box, newevent)
Example #10
Source File: i2cgui.py From i2cdriver with BSD 3-Clause "New" or "Revised" License | 5 votes |
def ping_thr(win): while True: wx.PostEvent(win, PingEvent()) time.sleep(1)
Example #11
Source File: color_dialog.py From wxGlade with MIT License | 5 votes |
def updateDisplayColour(self, colour): """Update the displayed color box (solid) and send the EVT_COLOUR_CHANGED""" self.solid.SetColour(colour) evt = ColourChangedEvent(newColour=colour) wx.PostEvent(self, evt)
Example #12
Source File: merger.py From iqiyi-parser with MIT License | 5 votes |
def pipe_open(self, cmdline): wx.PostEvent(gui.frame_merger.textctrl_output, MergerOutputAppendEvent('>>> ' + cmdline + '\n\n')) self.proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, stderr=subprocess.PIPE) self.proc.stdin.close() self.stdout = io.TextIOWrapper( self.proc.stdout, encoding='utf-8' ) self.stderr = io.TextIOWrapper( self.proc.stderr, encoding='utf-8' ) self._stdout_buff = [] stdout_thr = threading.Thread(target=self._readerthread, args=(self.stdout, self._stdout_buff), daemon=True) stdout_thr.start() self._stderr_buff = [] stderr_thr = threading.Thread(target=self._readerthread, args=(self.stderr, self._stderr_buff), daemon=True) stderr_thr.start() self.handle_output(self._stderr_buff, stderr_thr) self._stderr_buff = self._stdout_buff = [] gc.collect()
Example #13
Source File: SpinNumCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def SetValue(self, value): minValue, maxValue = self.numCtrl.GetBounds() if maxValue is not None and value > maxValue: value = maxValue if minValue is not None and value < minValue: value = minValue if value < 0 and not self.numCtrl.IsNegativeAllowed(): value = 0 res = self.numCtrl.SetValue(value) wx.PostEvent(self, eg.ValueChangedEvent(self.GetId(), value=value)) return res
Example #14
Source File: SmartSpinNumCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def SetValue(self, value): if isinstance(self.ctrl, eg.Classes.SpinNumCtrl.SpinNumCtrl): if isinstance(value, (str, unicode)): value = float(value) minValue, maxValue = self.ctrl.numCtrl.GetBounds() if maxValue is not None and value > maxValue: value = maxValue if minValue is not None and value < minValue: value = minValue elif isinstance(value, (int, float)): value = str(value) res = self.ctrl.SetValue(value) wx.PostEvent(self, eg.ValueChangedEvent(self.GetId(), value = value)) return res
Example #15
Source File: PythonEditorCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnModified(self, event): wx.PostEvent(self, eg.ValueChangedEvent(self.GetId())) event.Skip()
Example #16
Source File: PythonEditorCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnSavePointLeft(self, event): self.Bind(EVT_STC_MODIFIED, self.OnModified) wx.PostEvent(self, eg.ValueChangedEvent(self.GetId())) event.Skip()
Example #17
Source File: networkedit.py From CANFestivino with GNU Lesser General Public License v2.1 | 5 votes |
def OnLinkClicked(self, linkinfo): wx.PostEvent(self, HtmlWindowUrlClick(linkinfo))
Example #18
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnChange(self, event): evt = eg.ValueChangedEvent(self.id, value = self) wx.PostEvent(self, evt) event.Skip()
Example #19
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnDeleteButton(self, event=None): self.DeleteItem(self.sel) self.evtList[self.ix].pop(self.sel) evt = eg.ValueChangedEvent(self.id, value = self) wx.PostEvent(self, evt) if event: event.Skip()
Example #20
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnDeleteAllButton(self, event=None): self.DeleteAllItems() evt = eg.ValueChangedEvent(self.id, value = self) wx.PostEvent(self, evt) self.evtList[self.ix] = [] if event: event.Skip()
Example #21
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnScrollChanged(self, event=None): d = {"1": self.slider.GetValue()} self.valueLabelCtrl.SetLabel(self.valueLabel % d) if event: wx.PostEvent(self, eg.ValueChangedEvent(self.GetId()))
Example #22
Source File: wxAnyThread.py From KiCost with MIT License | 5 votes |
def invoke(self): """Invoke the method, blocking until the main thread handles it.""" wx.PostEvent(self.args[0],self) self.event.wait() try: return self.result except AttributeError: tb = self.traceback del self.traceback raise (type(self.exception), self.exception, tb)
Example #23
Source File: dochtml.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnLinkClicked(self, linkinfo): wx.PostEvent(self, HtmlWindowUrlClick(linkinfo))
Example #24
Source File: spotfinder_wrap.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _handle_message(self, message): # Just attach the message to an event and send it on evt = ZeroMQEvent(message=message) wx.PostEvent(self.target, evt)
Example #25
Source File: viewer_tools.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def SetSelection(self, index): if self._images.selected_index != index: # self._images.selected_index = index # print("Posting event from fake choice") # wx.PostEvent(self, wx.PyCommandEvent(wx.EVT_CHOICE.typeId, 1)) self._loader(self._images[index])
Example #26
Source File: spotfinder_frame.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def create_load_image_event(destination, filename): wx.PostEvent(destination, LoadImageEvent(myEVT_LOADIMG, -1, filename))
Example #27
Source File: wx_viewer.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def force_update(self, recenter=False): wx.PostEvent(self, ViewerUpdateEvent(data=None, recenter=recenter))
Example #28
Source File: squaremap.py From pyFileFixity with MIT License | 5 votes |
def SetSelected( self, node, point=None, propagate=True ): """Set the given node selected in the square-map""" if node == self.selectedNode: return self.selectedNode = node self.UpdateDrawing() if node: wx.PostEvent( self, SquareSelectionEvent( node=node, point=point, map=self ) )
Example #29
Source File: core.py From wafer_map with GNU General Public License v3.0 | 5 votes |
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)
Example #30
Source File: wm_legend.py From wafer_map with GNU General Public License v3.0 | 5 votes |
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)