本文整理汇总了Python中wx.Yield方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Yield方法的具体用法?Python wx.Yield怎么用?Python wx.Yield使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Yield方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gui_repaint
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例2: onApply
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例3: call_sct_command
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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()
示例4: CalibrateColor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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)
示例5: Run
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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)
示例6: AskSave
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例7: create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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()
示例8: readNMEA0183
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
def readNMEA0183(self, port, baudrate):
try:
self.serial = serial.Serial(port, baudrate, timeout=1)
except:
return False
timewait = time.time() + 1.5
index = 0
countwrong = 0
print 'search NMEA0183 on ' + port + ' with baudrate ' + baudrate
text = ''
while time.time() < timewait:
wx.Yield()
try:
c = self.serial.read(1)
except: c = ''
if c != '':
b = ord(c)
# print c
if b == 10 or b == 13 or (32 <= b < 128):
index += 1
if b == 13:
print ' ' + text[:-1]
text = ''
elif b == 10:
pass
else:
text += c
else:
#print 'countwrong ', b
countwrong += 1
if index > 10 and countwrong < index/10:
print 'found NMEA0183 on ' + port + ' with baudrate ' + str(baudrate)
return True
else:
return False
示例9: readNMEA0183name
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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'
示例10: readNMEA2000
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例11: flush_events
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
def flush_events(self):
wx.Yield()
示例12: Destroy
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例13: flush_events
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
def flush_events(self):
# docstring inherited
wx.Yield()
示例14: Destroy
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
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
示例15: destroy
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Yield [as 别名]
def destroy(self, *args):
DEBUG_MSG("destroy()", 1, self)
self.frame.Destroy()
wxapp = wx.GetApp()
if wxapp:
wxapp.Yield()