本文整理汇总了Python中kivy.uix.screenmanager.Screen类的典型用法代码示例。如果您正苦于以下问题:Python Screen类的具体用法?Python Screen怎么用?Python Screen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Screen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,**kwargs):
Screen.__init__(self,**kwargs)
self.log = kwargs['log']
self.status_display = None
self.display_limit = 100
self.visible = False
示例2: rebuild_homescreen
def rebuild_homescreen(self, mode=None, goto=True):
print "rebuilding homescreen"
t1 = time()
if mode is None:
mode = self.view_mode
if "Home" in self.screen_names:
oldhome = self.get_screen("Home")
self.remove_widget(oldhome)
if mode[:6] == "tablet":
hs = TabletHomeScreen(managedby=self)
else:
hs = HomeScreen(managedby=self)
t2 = time()
print "made homescreen", t2 - t1
hs_screen = Screen(name="Home")
hs_screen.add_widget(hs)
t3 = time()
self.add_widget(hs_screen)
print "made Screen", t3 - t2
self.refresh_open_games()
t4 = time()
print "refreshed open games", t4 - t3
print "total", t4 - t1
if goto:
if self.current == "Home":
self.make_empty_screen()
self.current = "emptyscreen"
self.current = "Home"
示例3: build
def build(self):
Builder.load_string(textwrap.dedent(
'''
<[email protected]>:
description_a: ''
description_b: ''
text: root.description_a + ' <newline> ' + root.description_b
halign:'center'
size_hint:(1, 0.1)
<MyListView>:
size_hint:(0.5, 0.5)
ListView:
item_strings: [str(index) for index in range(10)]
<OtherNamedScreen>:
GridLayout:
cols: 2
MyListView
ScrollView:
ContainerForButtons:
cols:1
row_default_height:150
size_hint_y: None
'''))
Window.bind(on_keyboard=self.check_what_key_was_pressed)
self.screen_mgr = ScreenManager()
first = Screen(name='First')
self.screen_mgr.add_widget(first)
first.add_widget(Button(text="click me", bind=self.swap_screen))
self.screen_mgr.add_widget(OtherNamedScreen(name='Second'))
return self.screen_mgr
示例4: __init__
def __init__(self, n_procesadores, **kwargs):
Builder.load_file(kwargs['archivo'])
Screen.__init__(self, **kwargs)
self.procesadores = None
self.tabla_procesos = None
self.popup_proceso = None
self.inicializar(n_procesadores)
self.tabla_procesos = self.tabla_procesos or TablaProcesosGUI(self.sistema.procesos)
self.procesadores = self.procesadores or [ProcesadorGUI(p, self.tabla_procesos) for p in self.sistema.procesadores]
self.popup_proceso = self.popup_proceso or ProcesoPopup(self.sistema)
self.ids.titulo.text = "Simulacion para "+self.name
self.popup_recurso = RecursoPopup(self.sistema)
self.tabla_recursos = TablaRecursosGUI(self.sistema.recursos)
self.ejecutando = False
self.paso = False
for p in self.procesadores:
self.ids.procesadores.add_widget(p)
self.c_procesos.add_widget(self.tabla_procesos)
self.c_recursos.add_widget(self.tabla_recursos)
self.sistema.asignar_vista(self)
示例5: GameApp
class GameApp(App):
def __init__(self, **kwargs):
"""
:param kwargs:
:return:
"""
super(GameApp, self).__init__(**kwargs)
self.textures = textures
self.screen_manager = ScreenManager()
self.menu_widget = Menu()
self.menu_screen = Screen(name="Menu")
self.menu_screen.add_widget(self.menu_widget)
self.screen_manager.add_widget(self.menu_screen)
self.game_widget = Level('../resources/test.png', self.textures)
self.game_screen = Screen(name="Game")
self.game_screen.add_widget(self.game_widget)
self.screen_manager.add_widget(self.game_screen)
def build(self):
"""
:return:
"""
self.screen_manager.current = 'Game'
return self.screen_manager
示例6: __init__
def __init__(self):
Screen.__init__(self)
self.name = 'file'
self.file_chooser = FileChooserListView(path=os.getcwd())
self.file_chooser.bind(on_submit=self.add_cards)
self.add_widget(self.file_chooser)
示例7: __init__
def __init__(self, **kwargs):
"""
:param kwargs:
:return:
"""
super(GameApp, self).__init__(**kwargs)
self.textures = textures
self.authorizations = authorizations
self.my_event_dispatcher = MenusEventDispatcher()
self.screen_manager = ScreenManager()
self.menu_widget = Menu(self.my_event_dispatcher)
self.menu_screen = Screen(name="Menu")
self.menu_screen.add_widget(self.menu_widget)
self.screen_manager.add_widget(self.menu_screen)
self.game_widget = LevelManager()
self.game_screen = Screen(name="LevelManager")
self.game_screen.add_widget(self.game_widget)
self.screen_manager.add_widget(self.game_screen)
self.menu_level_widget = MenuLevel(self.my_event_dispatcher)
self.menu_level_screen = Screen(name="MenuLevel")
self.menu_level_screen.add_widget(self.menu_level_widget)
self.screen_manager.add_widget(self.menu_level_screen)
self.my_event_dispatcher.bind(on_change_screen=self.do_change_screen)
示例8: __init__
def __init__(self, title, *args, **kwargs):
"""
@title - tytul (nazwa) cwiczenia
"""
Builder.load_file("kv/genericlevels.kv")
Screen.__init__(self, *args, **kwargs)
self.title = title
示例9: __init__
def __init__(self, **kwargs):
"""
:param kwargs:
:rtype: void
"""
super(GameApp, self).__init__(**kwargs)
self.menu_screen = Screen(name="Menu")
self.menu_level_screen = Screen(name="MenuLevel")
self.game_screen = Screen(name="LevelManager")
self.menu_widget = Menu(self.menus_event_dispatcher, self.music_provider)
self.menu_screen.add_widget(self.menu_widget)
self.screen_manager.add_widget(self.menu_screen)
self.game_widget = LevelManager(self.menus_event_dispatcher, self.music_provider)
self.game_screen.add_widget(self.game_widget)
self.screen_manager.add_widget(self.game_screen)
self.menu_level_widget = MenuLevel(self.menus_event_dispatcher)
self.menu_level_screen.add_widget(self.menu_level_widget)
self.screen_manager.add_widget(self.menu_level_screen)
self.menus_event_dispatcher.bind(on_change_screen=self.do_change_screen)
示例10: __init__
def __init__(self, name=""):
Screen.__init__(self, name=name)
self.layout = FloatLayout()
self.color = Label(text="Pick a Color or Animation",
pos_hint={'x': 0, 'y': .67},
size_hint=(1, .33),
font_size=32)
self.animations = Button(text="Pick Animation",
pos_hint={'x': 0, 'y': .34},
size_hint=(1, .33),
font_size=32)
self.sliders = Button(text="Custom Color",
pos_hint={'x': 0, 'y': 0},
size_hint=(.5, .34),
font_size=32)
self.main = Button(text="Return",
pos_hint={'x': .5, 'y': 0},
size_hint=(.5, .34),
font_size=32)
self.main.bind(on_release=self.go_to_main)
self.sliders.bind(on_release=self.go_to_sliders)
self.animations.bind(on_release=self.go_to_anims)
self.layout.add_widget(self.color)
self.layout.add_widget(self.animations)
self.layout.add_widget(self.sliders)
self.layout.add_widget(self.main)
self.add_widget(self.layout)
示例11: __init__
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
# Prepare the display areas
self.gameboard = BoardDisplay(board=self.game.board,
size_hint=(4, 1))
self.round_counter = RoundCounter(round_number=self.game.round,
max_round=GameSettings.NUM_ROUNDS,
size_hint=(1, .075))
self.scoreboard = ScoreDisplay(scoreboard=self.game.score,
size_hint=(1, .4))
self.tooltip = ToolTipDisplay(size_hint=(1, .5))
self.hand_display = HandDisplay(hand=self.game.players[PLAYER],
size_hint=(1, .3))
# Lay out the display
main = BoxLayout(orientation="vertical")
layout = BoxLayout()
layout.add_widget(self.gameboard)
sidebar = BoxLayout(orientation="vertical")
sidebar.add_widget(self.round_counter)
sidebar.add_widget(self.scoreboard)
sidebar.add_widget(self.tooltip)
layout.add_widget(sidebar)
main.add_widget(layout)
main.add_widget(self.hand_display)
self.add_widget(main)
示例12: build
def build(self):
self.sm = TouchyScreenManager()
for storyline in intro.splitlines():
screen = Screen(name=storyline)
screen.add_widget(Label(text=storyline))
self.sm.add_widget(screen)
return self.sm
示例13: __init__
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
main = BoxLayout(orientation="vertical")
main.add_widget(ActionBar(size_hint=(1, .125)))
carousel = Carousel(direction='right')
layout = GridLayout(rows=2)
i, c = 0, 0
for card in self.definition.cards(App.get_running_app().achievements,
use_blocks=False):
color = (1, 1, 1, 1)
if str(card) in self.definition.blocked_cards:
color = (.5, 0, 0, 1)
layout.add_widget(CardSelect(card=card,
color=color,
callback=self._card_detail,
args=(card,)))
i += 1
c += 1
if i == 10:
carousel.add_widget(layout)
layout = GridLayout(rows=2)
i = 0
if c < 50 + len(self.definition.specials):
layout.add_widget(CardSelect(card=self.LOCKED_CARD))
carousel.add_widget(layout)
main.add_widget(carousel)
self.add_widget(main)
示例14: __init__
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
self.tryout = StackLayout(orientation ='lr-bt')
self.floatt = FloatLayout()
#variable for gettinginformation()
self.counter = 0
# Title of the screen
self.floatt.add_widget(Label(text='[color=000000][size=40][font=yorkwhiteletter]EBOTS INFORMATION[/font][/size][/color]', size_hint=(0.5,0.2),markup=True,pos_hint={'x':0.05,'y':0.8}))
#information on ebots with 'good' status
self.ebotgoodpic = Image(source='C:\Users\The Gt Zan\Pictures\ebotinfo.PNG')
self.floatt.add_widget(self.ebotgoodpic)
#buttons at the bottom
self.switchtomenu = Button(text='[size=50][font=yorkwhiteletter][color=000000]MENU[/font][/size][/color]',markup=True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToMenu)
self.switchtoebot = Button(text='[size=50][font=yorkwhiteletter][color=000000]EBOTS[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToebots)
self.switchtopersonal = Button(text='[size=50][font=yorkwhiteletter][color=000000]INDIVIDUAL[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToPersonal)
self.tryout.add_widget(self.switchtoebot)
self.tryout.add_widget(self.switchtopersonal)
self.tryout.add_widget(self.switchtomenu)
#getting information
self.refresh=Button(text='[size=50][font=yorkwhiteletter][color=000000]REFRESH[/font][/size][/color]', markup = True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.gettinginformation)
self.tryout.add_widget(self.refresh)
#add layouts
self.add_widget(self.tryout)
self.add_widget(self.floatt)
示例15: rebuild_homescreen
def rebuild_homescreen(self, mode=None, goto=True):
print 'rebuilding homescreen'
t1 = time()
if mode is None:
mode = self.view_mode
if 'Home' in self.screen_names:
oldhome = self.get_screen('Home')
self.remove_widget(oldhome)
if mode[:6] == 'tablet':
hs = TabletHomeScreen(managedby=self)
else:
hs = HomeScreen(managedby=self)
t2 = time()
print 'made homescreen', t2-t1
hs_screen = Screen(name='Home')
hs_screen.add_widget(hs)
t3 = time()
self.add_widget(hs_screen)
print 'made Screen', t3-t2
self.refresh_open_games()
t4 = time()
print 'refreshed open games', t4-t3
print 'total', t4-t1
if goto:
if self.current == 'Home':
self.make_empty_screen()
self.current = 'emptyscreen'
self.current = 'Home'