本文整理汇总了Python中ui.in_background方法的典型用法代码示例。如果您正苦于以下问题:Python ui.in_background方法的具体用法?Python ui.in_background怎么用?Python ui.in_background使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui
的用法示例。
在下文中一共展示了ui.in_background方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show
# 需要导入模块: import ui [as 别名]
# 或者: from ui import in_background [as 别名]
def show(self):
"""shows the view and starts a thread."""
self.present(orientations=ORIENTATIONS)
# launch a background thread
# we can not use ui.in_background here
# because some dialogs would not open anymoe
thr = threading.Thread(target=self.show_messages)
thr.daemon = True
thr.start()
示例2: printLog
# 需要导入模块: import ui [as 别名]
# 或者: from ui import in_background [as 别名]
def printLog():
### Pull the contents back into a string and close the stream
global log_capture_string
log_contents = log_capture_string.getvalue()
log_capture_string.close()
log_capture_string = StringIO()
logger.handlers[0].stream=log_capture_string
print(log_contents.lower())
## run a runction in an async thread. better than ui.in_background for this application, because it is not queued up
示例3: getFile
# 需要导入模块: import ui [as 别名]
# 或者: from ui import in_background [as 别名]
def getFile(setter=None,base_dir='.'):
fv = FileViewer(setter,base_dir)
fv.height=700
nv = ui.NavigationView(fv)
def openDocuments(sender,path):
def setme(fv,value):
# set and bubble up setters
fv.src.sel[0]=value
if fv.src.setter is not None:
fv.src.setter(value)
newfv = FileViewer(setter=lambda value:setme(fv,value),base_dir=path)
nv.push_view(newfv)
nv.right_button_items=[
ui.ButtonItem(title='Documents',
action=lambda sender:openDocuments(sender,os.path.expanduser('~/Documents'))),
ui.ButtonItem(title='Library',
action=lambda sender:openDocuments(sender,os.path.split(os.__file__)[0]))]
nv.height=800
nv.width=500
nv.name = 'File Selector'
nv.present('popover')
ui.in_background(nv.wait_modal)
nv.wait_modal()
return fv.src.sel[0]