本文整理匯總了Python中kivy.app.App方法的典型用法代碼示例。如果您正苦於以下問題:Python app.App方法的具體用法?Python app.App怎麽用?Python app.App使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy.app
的用法示例。
在下文中一共展示了app.App方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: on_touch_up
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def on_touch_up( self, touch ):
global minUITimer
if touch.grab_current is self:
touch.ungrab( self )
with thermostatLock:
if minUITimer != None:
Clock.unschedule( show_minimal_ui )
minUITimer = Clock.schedule_once( show_minimal_ui, minUITimeout )
self.manager.current = "thermostatUI"
log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCREEN, MSG_SUBTYPE_TEXT, "Full" )
return True
##############################################################################
# #
# Kivy Thermostat App class #
# #
##############################################################################
示例2: build
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def build(self):
# adding GridLayouts in App
# Defining number of coloumn
# You can use row as well depends on need
layout = GridLayout(cols = 2)
# 1st row
layout.add_widget(Button(text ='Hello 1'))
layout.add_widget(Button(text ='World 1'))
# 2nd row
layout.add_widget(Button(text ='Hello 2'))
layout.add_widget(Button(text ='World 2'))
# 3rd row
layout.add_widget(Button(text ='Hello 3'))
layout.add_widget(Button(text ='World 3'))
# 4th row
layout.add_widget(Button(text ='Hello 4'))
layout.add_widget(Button(text ='World 4'))
# returning the layout
return layout
# creating object of the App class
示例3: on_start
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def on_start(self):
# bind to the keyboard to listen to
# specific key codes
from utils.keyboard import hook_keyboard
hook_keyboard()
# let's load our first screen
load_screen('StartupScreen')
# Check if app is started as main and only then insitantiate the App class.
示例4: add_kivy_panel
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def add_kivy_panel(self):
'''Add a panel for configuring Kivy. This panel acts directly on the
kivy configuration. Feel free to include or exclude it in your
configuration.
See :meth:`~kivy.app.App.use_kivy_settings` for information on
enabling/disabling the automatic kivy panel.
'''
from kivy import kivy_data_dir
from kivy.config import Config
from os.path import join
self.add_json_panel('Kivy', Config,
join(kivy_data_dir, 'settings_kivy.json'))
示例5: __init__
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def __init__(self, app=None, *args, **kwargs):
if app is None:
app = App()
EventLoop.safe = Event()
self.safe = EventLoop.safe
self.safe.set()
EventLoop.confirmed = Event()
self.confirmed = EventLoop.confirmed
self.app = app
def startApp(app=app, *args, **kwargs):
app.run(*args, **kwargs)
self.thread = Thread(target=startApp, *args, **kwargs)
示例6: main
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def main():
# Start Web Server
webThread = threading.Thread( target=startWebServer )
webThread.daemon = True
webThread.start()
# Start Scheduler
reloadSchedule()
schedThread = threading.Thread( target=startScheduler )
schedThread.daemon = True
schedThread.start()
# Start Thermostat UI/App
ThermostatApp().run()
示例7: load_screen
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def load_screen(self, screen, manager=None, store_back=True):
'''Load the provided screen:
arguments::
`screen`: is the name of the screen to be loaded
`manager`: the manager to load this screen, this defaults to
the main class.
'''
store_back = False if screen == 'StartupScreen' else store_back
manager = manager or self.root
# load screen modules dynamically
# for example load_screen('LoginScreen')
# will look for uix/screens/loginscreen
# load LoginScreen
module_path = screen.lower()
if not hasattr(self, module_path):
import imp
module = imp.load_module(screen, *imp.find_module(module_path))
screen_class = getattr(module, screen)
sc = screen_class()
sc.from_back = not store_back
setattr(self, module_path, sc)
manager.add_widget(sc)
else:
sc = getattr(self, module_path)
sc.from_back = not store_back
manager.current = screen
if store_back:
self._navigation_higherarchy.append(sc)
return getattr(self, module_path)
# Check if app is started as main and only then insitantiate the App class.
示例8: build
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def build(self):
EventLoop.ensure_window()
EventLoop.window.title = self.title = 'Rockivy | Kivy App Contest 2014'
if EventLoop.window.__class__.__name__.endswith('Pygame'):
try:
# because pygame hates nice cursors
pygame_set_cursor()
except:
pass
game = Game()
self.on_start = game.on_start
return init_ui(game)
示例9: exit_game
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def exit_game(self):
exit(0)
# App share with Android
# It will open an intent to share a message
示例10: image
# 需要導入模塊: from kivy import app [as 別名]
# 或者: from kivy.app import App [as 別名]
def image(self, filename, load_callback=None, post_callback=None,
**kwargs):
'''Load a image using the Loader. A ProxyImage is returned with a
loading image. You can use it as follows::
from kivy.app import App
from kivy.uix.image import Image
from kivy.loader import Loader
class TestApp(App):
def _image_loaded(self, proxyImage):
if proxyImage.image.texture:
self.image.texture = proxyImage.image.texture
def build(self):
proxyImage = Loader.image("myPic.jpg")
proxyImage.bind(on_load=self._image_loaded)
self.image = Image()
return self.image
TestApp().run()
In order to cancel all background loading, call *Loader.stop()*.
'''
data = Cache.get('kv.loader', filename)
if data not in (None, False):
# found image, if data is not here, need to reload.
return ProxyImage(data,
loading_image=self.loading_image,
loaded=True, **kwargs)
client = ProxyImage(self.loading_image,
loading_image=self.loading_image, **kwargs)
self._client.append((filename, client))
if data is None:
# if data is None, this is really the first time
self._q_load.appendleft({
'filename': filename,
'load_callback': load_callback,
'post_callback': post_callback,
'kwargs': kwargs})
if not kwargs.get('nocache', False):
Cache.append('kv.loader', filename, False)
self._start_wanted = True
self._trigger_update()
else:
# already queued for loading
pass
return client
#
# Loader implementation
#