本文整理匯總了Python中PyObjCTools.AppHelper.stopEventLoop方法的典型用法代碼示例。如果您正苦於以下問題:Python AppHelper.stopEventLoop方法的具體用法?Python AppHelper.stopEventLoop怎麽用?Python AppHelper.stopEventLoop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyObjCTools.AppHelper
的用法示例。
在下文中一共展示了AppHelper.stopEventLoop方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _runMainRunLoop
# 需要導入模塊: from PyObjCTools import AppHelper [as 別名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 別名]
def _runMainRunLoop(self):
# Create background thread to run user code.
self._user_thread = threading.Thread(target=self._user_thread_main)
self._user_thread.daemon = True
self._user_thread.start()
# Run main loop. This call will never return!
try:
AppHelper.runConsoleEventLoop(installInterrupt=True)
except KeyboardInterrupt:
AppHelper.stopEventLoop()
sys.exit(0)
示例2: run_mainloop_with
# 需要導入模塊: from PyObjCTools import AppHelper [as 別名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 別名]
def run_mainloop_with(self, target):
"""Start the OS's main loop to process asyncronous BLE events and then
run the specified target function in a background thread. Target
function should be a function that takes no parameters and optionally
return an integer response code. When the target function stops
executing or returns with value then the main loop will be stopped and
the program will exit with the returned code.
Note that an OS main loop is required to process asyncronous BLE events
and this function is provided as a convenience for writing simple tools
and scripts that don't need to be full-blown GUI applications. If you
are writing a GUI application that has a main loop (a GTK glib main loop
on Linux, or a Cocoa main loop on OSX) then you don't need to call this
function.
"""
# Create background thread to run user code.
self._user_thread = threading.Thread(target=self._user_thread_main,
args=(target,))
self._user_thread.daemon = True
self._user_thread.start()
# Run main loop. This call will never return!
try:
AppHelper.runConsoleEventLoop(installInterrupt=True)
except KeyboardInterrupt:
AppHelper.stopEventLoop()
sys.exit(0)
示例3: endLoop
# 需要導入模塊: from PyObjCTools import AppHelper [as 別名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 別名]
def endLoop(self):
AppHelper.stopEventLoop()
示例4: about
# 需要導入模塊: from PyObjCTools import AppHelper [as 別名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 別名]
def about(self, sender):
#rumps.alert("My quit message")
self.apiServer.shutdown()
AppHelper.stopEventLoop()
print "after stop"
#@rumps.clicked("Arbitrary", "Depth", "It's pretty easy") # very simple to access nested menu items
#def does_something(self, sender):
# my_data = {'poop': 88}
# rumps.notification(title='Hi', subtitle='There.', message='Friend!', data=my_data)
#@rumps.clicked("Preferences")
#def not_actually_prefs(self, sender):
# if not sender.icon:
# sender.icon = 'level_4.png'
# sender.state = not sender.state
#@rumps.timer(4) # create a new thread that calls the decorated function every 4 seconds
#def write_unix_time(self, sender):
# with self.rumps_app.open('times', 'a') as f: # this opens files in your app's Application Support folder
# f.write('The unix time now: {}\n'.format(time.time()))
#@rumps.clicked("Arbitrary")
#def change_statusbar_title(self, sender):
# app.title = 'Hello World' if self.rumps_app.title != 'Hello World' else 'World, Hello'
示例5: centralManager_didDisconnectPeripheral_error_
# 需要導入模塊: from PyObjCTools import AppHelper [as 別名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 別名]
def centralManager_didDisconnectPeripheral_error_(self, manager, peripheral, error):
log.debug("centralManager_didDisconnectPeripheral_error_")
self.connected = False
#AppHelper.stopEventLoop()