Python wx.Yield() Examples
The following are 30
code examples of wx.Yield().
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: backend_wx.py From neural-network-animation with MIT License | 6 votes |
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen(): if drawDC is None: drawDC=wx.ClientDC(self) drawDC.BeginDrawing() drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() #wx.GetApp().Yield() else: pass
Example #2
Source File: backend_wx.py From ImageFusion with MIT License | 6 votes |
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen(): if drawDC is None: drawDC=wx.ClientDC(self) drawDC.BeginDrawing() drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() #wx.GetApp().Yield() else: pass
Example #3
Source File: g.gui.tangible.py From grass-tangible-landscape with GNU General Public License v2.0 | 6 votes |
def CalibrateColor(self): ll = self.giface.GetLayerList() checked = [] for l in ll: if ll.IsLayerChecked(l): checked.append(l.cmd) ll.CheckLayer(l, False) wx.Yield() self.scaniface.Scan(continuous=False) self.scaniface.process.wait() self.scaniface.process = None self.scaniface.status.SetLabel("Done.") self._defineEnvironment() self._calibrateColor() # check the layers back to previous state ll = self.giface.GetLayerList() for l in ll: if l.cmd in checked: ll.CheckLayer(l, True)
Example #4
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 6 votes |
def call_sct_command(self, command): print("Running: {}".format(command)) binfo = ProgressDialog(frame) binfo.Show() thr = SCTCallThread(command) thr.start() # No access to app.pending() from here while True: thr.join(0.1) wx.Yield() if not thr.isAlive(): break thr.join() binfo.Destroy() # Open error dialog if stderr is not null if thr.status: binfo = ErrorDialog(frame) binfo.Show()
Example #5
Source File: gui.py From superpaper with MIT License | 6 votes |
def onApply(self, event): """Applies the currently open profile. Saves it first.""" busy = wx.BusyCursor() saved_file = self.onSave(None) sp_logging.G_LOGGER.info("onApply profile: saved %s", saved_file) if saved_file: saved_profile = ProfileData(saved_file) self.parent_tray_obj.reload_profiles(event) wx.Yield() thrd = self.parent_tray_obj.start_profile(event, saved_profile, force_reload=True) if thrd: while thrd.is_alive(): time.sleep(0.5) else: pass del busy
Example #6
Source File: color_interaction.py From grass-tangible-landscape with GNU General Public License v2.0 | 6 votes |
def Run(self, func): ll = self.giface.GetLayerList() checked = [] for l in ll: if ll.IsLayerChecked(l): checked.append(l.cmd) ll.CheckLayer(l, False) wx.Yield() if not self.scaniface.IsScanning(): self.scaniface.Scan(continuous=False) self.scaniface.process.wait() self.scaniface.process = None self.scaniface.status.SetLabel("Done.") self.Done(func, checked) elif self.scaniface.pause: pass else: wx.CallLater(3000, self.Done, func, checked)
Example #7
Source File: xrced.py From admin4 with Apache License 2.0 | 6 votes |
def AskSave(self): if not (self.modified or panel.IsModified()): return True flags = wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL | wx.CENTRE dlg = wx.MessageDialog( self, 'File is modified. Save before exit?', 'Save before too late?', flags ) say = dlg.ShowModal() dlg.Destroy() wx.Yield() if say == wx.ID_YES: self.OnSaveOrSaveAs(wx.CommandEvent(wx.ID_SAVE)) # If save was successful, modified flag is unset if not self.modified: return True elif say == wx.ID_NO: self.SetModified(False) panel.SetModified(False) return True return False
Example #8
Source File: edit_windows.py From wxGlade with MIT License | 6 votes |
def create(self): # creates/shows the widget of the given toplevel node and all its children wx.BeginBusyCursor() try: WindowBase.create(self) finally: wx.EndBusyCursor() # from old code: # below, probably check_prop should be False ## set the best size for the widget (if no one is given) #if not self.check_prop('size'): #if self.sizer: # self.sizer is the containing sizer, i.e. the parent #self.sizer.fit_parent() #elif self.WX_CLASS=="wxPanel" and self.children: #wx.Yield() # by now, there are probably many EVT_SIZE in the queue #self.children[0].fit_parent() self.widget.GetTopLevelParent().Show() # SafeYield and SetFocus are required for e.g. Ubuntu w. Python 3.8 and wxPython 4.0.7 # see file SIMPLIFICATIONS\Tests_full.wxg where the first frame will not be layouted wx.SafeYield() self.widget.Raise() self.widget.SetFocus()
Example #9
Source File: backend_wx.py From matplotlib-4-abaqus with MIT License | 6 votes |
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen(): if drawDC is None: drawDC=wx.ClientDC(self) drawDC.BeginDrawing() drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() #wx.GetApp().Yield() else: pass
Example #10
Source File: backend_wx.py From Computable with MIT License | 6 votes |
def gui_repaint(self, drawDC=None): """ Performs update of the displayed image on the GUI canvas, using the supplied device context. If drawDC is None, a ClientDC will be used to redraw the image. """ DEBUG_MSG("gui_repaint()", 1, self) if self.IsShownOnScreen(): if drawDC is None: drawDC=wx.ClientDC(self) drawDC.BeginDrawing() drawDC.DrawBitmap(self.bitmap, 0, 0) drawDC.EndDrawing() #wx.GetApp().Yield() else: pass
Example #11
Source File: backend_wx.py From CogAlg with MIT License | 5 votes |
def destroy(self, *args): DEBUG_MSG("destroy()", 1, self) self.frame.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield()
Example #12
Source File: backend_wx.py From twitter-stock-recommendation with MIT License | 5 votes |
def destroy(self, *args): DEBUG_MSG("destroy()", 1, self) self.frame.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield()
Example #13
Source File: backend_wx.py From ImageFusion with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): try: self.canvas.mpl_disconnect(self.toolbar._idDrag) # Rationale for line above: see issue 2941338. except AttributeError: pass # classic toolbar lacks the attribute wx.Frame.Destroy(self, *args, **kwargs) if self.toolbar is not None: self.toolbar.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield() return True
Example #14
Source File: backend_wx.py From twitter-stock-recommendation with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): try: self.canvas.mpl_disconnect(self.toolbar._idDrag) # Rationale for line above: see issue 2941338. except AttributeError: pass # classic toolbar lacks the attribute if not self.IsBeingDeleted(): wx.Frame.Destroy(self, *args, **kwargs) if self.toolbar is not None: self.toolbar.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield() return True
Example #15
Source File: backend_wx.py From twitter-stock-recommendation with MIT License | 5 votes |
def flush_events(self): wx.Yield()
Example #16
Source File: test_CustomIntCtrl.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def ProcessEvents(self): for dummy in range(0, 10): wx.Yield() time.sleep(0.01)
Example #17
Source File: test_application.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def ProcessEvents(self): for dummy in range(0, 30): self.CheckForErrors() wx.Yield() time.sleep(0.01)
Example #18
Source File: Update.py From admin4 with Apache License 2.0 | 5 votes |
def OnCheckUpdate(self, evt): self.ModuleInfo=xlt("Checking...") wx.Yield() adm.updateInfo=OnlineUpdate() self.DoCheckUpdate()
Example #19
Source File: backend_wx.py From CogAlg with MIT License | 5 votes |
def flush_events(self): # docstring inherited wx.Yield()
Example #20
Source File: gui.py From reversi-alpha-zero with MIT License | 5 votes |
def handle_game_event(self, event): if event == GameEvent.update: self.panel.Refresh() self.update_status_bar() wx.Yield() elif event == GameEvent.over: self.game_over() elif event == GameEvent.ai_move: self.ai_move()
Example #21
Source File: gui.py From reversi-alpha-zero with MIT License | 5 votes |
def ai_move(self): self.panel.Refresh() self.update_status_bar() wx.Yield() self.model.move_by_ai() self.model.play_next_turn()
Example #22
Source File: backend_wx.py From coffeegrindsize with MIT License | 5 votes |
def flush_events(self): wx.Yield()
Example #23
Source File: app.py From thotkeeper with BSD 2-Clause "Simplified" License | 5 votes |
def _SaveEntriesToPath(self, path=None): wx.Yield() wx.BeginBusyCursor() try: if self.entry_modified: year, month, day, author, subject, text, id, tags \ = self._GetEntryFormBits() if id is None: id = self.entries.get_last_id(year, month, day) if id is None: id = 1 else: id = id + 1 self.entry_form_key = TKEntryKey(year, month, day, id) self.entries.store_entry(TKEntry(author, subject, text, year, month, day, id, tags)) if path is None: path = self.conf.data_file self._SaveData(path, self.entries) if path != self.conf.data_file: self._SetDataFile(path, False) self._SetEntryModified(False) self._SetDiaryModified(False) self.frame.FindWindowById(self.next_id).Enable(True) finally: wx.EndBusyCursor()
Example #24
Source File: backend_wx.py From coffeegrindsize with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): try: self.canvas.mpl_disconnect(self.toolbar._idDrag) # Rationale for line above: see issue 2941338. except AttributeError: pass # classic toolbar lacks the attribute if not self.IsBeingDeleted(): wx.Frame.Destroy(self, *args, **kwargs) if self.toolbar is not None: self.toolbar.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield() return True
Example #25
Source File: backend_wx.py From coffeegrindsize with MIT License | 5 votes |
def destroy(self, *args): DEBUG_MSG("destroy()", 1, self) self.frame.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield()
Example #26
Source File: backend_wx.py From CogAlg with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): try: self.canvas.mpl_disconnect(self.toolbar._idDrag) # Rationale for line above: see issue 2941338. except AttributeError: pass # classic toolbar lacks the attribute if not self.IsBeingDeleted(): wx.Frame.Destroy(self, *args, **kwargs) if self.toolbar is not None: self.toolbar.Destroy() wxapp = wx.GetApp() if wxapp: wxapp.Yield() return True
Example #27
Source File: backend_wx.py From neural-network-animation with MIT License | 5 votes |
def flush_events(self): wx.Yield()
Example #28
Source File: autosetup_tty.py From openplotter with GNU General Public License v2.0 | 5 votes |
def readNMEA0183name(self, port, baudrate): self.serial = serial.Serial(port, baudrate, timeout=1) timewait = time.time() + 10.1 name_list = [] nmea = self.serial.readline() while time.time() < timewait: wx.Yield() nmea = self.serial.readline() print ' ' + nmea[:-2] if len(nmea) > 7: if nmea[1:3] not in name_list: name_list.append(nmea[1:3]) if len(name_list) > 1: self.mpx+=1 return 'MPX'+str(self.mpx) elif len(name_list) == 1: return name_list[0] else: return 'UNDEF'
Example #29
Source File: autosetup_tty.py From openplotter with GNU General Public License v2.0 | 5 votes |
def readNMEA2000(self, port, baudrate): try: self.serial = serial.Serial(port, baudrate, timeout=1) except: return False timewait = time.time() + 0.5 print 'search NMEA2000 on ' + port + ' with baudrate ' + baudrate data = [0x10, 0x2, 0xa1, 0x01, 0x01, 0x5d, 0x10, 0x03] for i in data: self.serial.write(chr(i)) while time.time() < timewait: try: c = self.serial.read(1) except: c = '' if c != '': b = ord(c) if b == 0x10: try: c = self.serial.read(1) except: c = '' if c != '': b = ord(c) if b == 0x02: print 'found NMEA2000 on ' + port + ' with baudrate ' + str(baudrate) wx.Yield() return True print 'not found NMEA2000 on ' + port + ' with baudrate ' + str(baudrate) wx.Yield() return False
Example #30
Source File: backend_wx.py From Computable with MIT License | 5 votes |
def flush_events(self): wx.Yield()