我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用kivy.uix.screenmanager.SlideTransition()。
def build(self): self.transition = SlideTransition(duration = 0.8) self.about_popup = AboutPopup() setPage = Set(name = "setPage") clockPage = Clock(name = "clockPage") colorPage = Color(name = "colorPage") self.setPage = setPage self.clockPage = clockPage self.colorPage = colorPage scene = ScreenManager(transition = self.transition) self.scene = scene scene.add_widget(setPage) scene.add_widget(clockPage) scene.add_widget(colorPage) scene.current = "setPage" return scene
def connect(self, nameInput, teamInput, serverInput, original, tetrifast): # P?ipojuje k serveru, kontrola vstup? if (len(nameInput.text) > 0) and (len(serverInput.text) > 0): self.root.nickname = nameInput.text.strip() self.root.team = teamInput.text.strip() self.root.server = serverInput.text.strip() self.root.tetrifast = tetrifast.active if self.root.onAndroid(): android.hide_keyboard() self.root.vibrate(0.05) self.root.Cfg[1] = self.root.nickname self.root.Cfg[2] = self.root.team if self.bookmark.active: self.root.addBookmark = True self.root.refreshCfg() self.root.connect_to_server() self.root.overlay.setSize() self.root.sm.current = 'GameScreen' self.root.sm.transition = SlideTransition(direction="left") else: Toast(text='Name or server missing', timeout=2).open()
def popupDisconnect(self, instance): # Odpojení ze serveru z vyskakovacího okna (po stisku systémové klávesy zp?t v herní obrazovce) # Pouze pro OS Android self.popupExit.dismiss(instance) self.print_message("endgame\xff") self.startgame(instance) Clock.unschedule(self.heartbeat) self.sm.get_screen("StatsScreen").stats.clear_widgets() self.sm.get_screen("PartylineScreen").SLayout.clear_widgets() self.disconnect = True self.connection.loseConnection() self.connection = None self.id = False self.field.startgame = False self.sm.transition = SlideTransition(direction="right") self.sm.current = 'ConnectScreen'
def on_swipe_right(self): # Vyvoláno p?i tažení prstu doprava na obrazovkách obsahující # GestureListener self.sm.transition = SlideTransition(direction="right") if self.sm.current_screen.name == "GameScreen": self.sm.current = "PartylineScreen" self.chat.text = "" self.chat.unread.opacity = 0 else: try: if self.sm.current_screen.input.focus: self.sm.current_screen.input.focus = False except: pass self.sm.current = "StatsScreen" print "< swipe right >"
def __init__(self): super(FarmGame,self).__init__(transition=SlideTransition()) self.farm_screen = FarmScreen(name='game') self.sell_screen = SellScreen(name='sell') self.title_screen = TitleScreen(name='title') self.achievement_screen = AchievementScreen(name='achievement') self.upgrade_screen = UpgradeScreen(name='upgrade') self.add_widget(self.title_screen) # self.add_widget(self.upgrade_screen) self.add_widget(self.farm_screen) self.add_widget(self.sell_screen) # self.add_widget(self.achievement_screen) print self.screen_names self.register_event_type('on_plant') self.register_event_type('on_fertilize') self.register_event_type('on_harvest') self.register_event_type('on_plant_selection') self.register_event_type('on_fert_selection') self.register_event_type('on_plant_sell')
def do_login(self, loginText, passwordText): a = SnapDB() val = a.checkLogin(nickname=loginText, password=passwordText) userID = val[1] if val[1] != None: a = SnapDB() a.getUserData(userID) popup = Popup(title='Hola', content=Label(text='Hi '+localFiles.getLocalUserInfo()[2].split(" ")[0]+', happy snapchatting!'), size_hint=(None, None), size=(350, 200)) popup.open() self.manager.transition = SlideTransition(direction="left") self.manager.current = 'connected' else: popup = Popup(title='Error', content=Label(text='The password or username are incorrect. Try again.'), size_hint=(None, None), size=(350, 200)) popup.open() app = App.get_running_app() app.config.read(app.get_application_config()) app.config.write()
def prev(self): # Metoda pro návrat na p?edchozí obrazovku if self.input.focus: self.input.focus = False self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'GameScreen' # Obrazovka se statistikami ze serveru
def prev(self): # Metoda pro návrat na p?edchozí obrazovku self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'PartylineScreen' # Obrázek v 'Action baru' (ikona aplikace naho?e)
def setLang(self, lang): # Voláno po kliknutí na p?íslušný jazyk, import ?et?zc? if self.root.Cfg: self.root.sm.transition = SlideTransition(direction="right") self.root.makeCfg(lang) self.root.doStrInsert() self.manager.current = self.manager.next()
def connect(self): # P?esun na obrazovku p?ipojení k serveru self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'ConnectScreen'
def bookmarks(self): # p?esun na obrazovku se záložkami self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'BookmarksScreen'
def tutorial(self): # P?esun na obrazovku s tutorialem self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'TutorialMove' # Obrazovka s 'Action barem'
def prev(self): # Metoda pro návrat na p?edchozí obrazovku self.root.sm.transition = SlideTransition(direction="right") self.root.sm.current = 'MainMenuScreen' # Obrazovka s p?ipojením k serveru
def prev(self, *args): # Metoda pro návrat na p?edchozí obrazovku self.root.sm.transition = SlideTransition(direction="right") self.root.sm.current = 'MainMenuScreen' Clock.unschedule(self.nextFrame)
def nextScreen(self, *args): # P?echod na další obrazovku tutorialu self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = self.root.sm.next() Clock.unschedule(self.nextFrame)
def nextScreen(self, *args): self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = self.root.sm.next() Clock.unschedule(self.nextFrame)
def prev(self, *args): self.root.sm.transition = SlideTransition(direction="right") self.root.sm.current = 'TutorialDrop' Clock.unschedule(self.nextFrame)
def prev(self, *args): self.root.sm.transition = SlideTransition(direction="right") self.root.sm.current = 'TutorialSpecial' Clock.unschedule(self.nextFrame)
def nextScreen(self, *args): self.root.sm.transition = SlideTransition(direction="left") self.root.sm.current = 'MainMenuScreen' Clock.unschedule(self.nextFrame)
def setup_gui(self): # vytvá?í grafické rozhraní self.sm = ScreenManager(transition=SlideTransition(direction="left")) self.gameScreen = Screen(name='GameScreen') self.layout = FloatLayoutBG(size_hint=(1,1)) self.sOverlay = FloatLayout(size_hint=(1,1)) self.field = GameMatrix(self, cols=12, rows=22, size_hint=(0.75, 0.83), pos_hint={'center_x':0.5, 'center_y':0.5}, master=self.layout, spacing=1) self.id_label = Label(font_name='font/Roboto-Thin.ttf', text=u'', pos_hint={'top':1, 'right':0.125}, size_hint=(0.125,0.085), font_size='48dp') self.overlay = Overlay(self, size_hint=(.1,1), pos_hint={"right":1}) self.dock = Dock(self, size_hint=(0.75,0.0845), pos_hint={'center_x':0.5}, opacity=1) self.layout.add_widget(self.field, index=0) self.layout.add_widget(self.id_label, index=0) self.nicknameLabel = Label(font_name='font/Roboto-Regular.ttf', text=self.nickname, pos_hint={'top':1, 'center_x':0.5}, font_size='26dp', size_hint=(0.75,0.085)) self.nextPiece = NextPiece() self.layout.add_widget(self.nextPiece) self.layout.add_widget(self.nicknameLabel, index=0) self.layout.add_widget(self.dock, index=0) self.layout.add_widget(self.overlay) self.layout.add_widget(self.sOverlay) self.layout.add_widget(GestureListener(root=self, pos_hint={'x': 0})) self.chat = Notification() self.chat.unread.opacity = 0 self.layout.add_widget(self.chat) self.gameScreen.add_widget(self.layout) self.sm.add_widget(LanguageScreen(name='LanguageScreen', root=self)) self.sm.add_widget(MainMenuScreen(name='MainMenuScreen', root=self)) self.sm.add_widget(ConnectScreen(name='ConnectScreen', root=self)) self.sm.add_widget(self.gameScreen) self.sm.add_widget(PartylineScreen(name="PartylineScreen", root=self)) self.sm.add_widget(StatsScreen(name="StatsScreen", root=self)) self.sm.add_widget(SettingsScreen(name="SettingsScreen", root=self)) self.sm.add_widget(BookmarksScreen(name="BookmarksScreen", root=self)) self.sm.add_widget(TutorialMove(root=self, name="TutorialMove", directory="moving", frames=5)) self.sm.add_widget(TutorialDrop(root=self, name="TutorialDrop", directory="drop", frames=3)) self.sm.add_widget(TutorialSpecial(root=self, name="TutorialSpecial", directory="sendspecial", frames=4)) self.sm.add_widget(TutorialNavigate(root=self, name="TutorialNavigate", directory="navigation", frames=7)) self.sm.add_widget(TutorialPlayers(root=self, name="TutorialPlayers", directory="players", frames=4)) return self.sm
def on_swipe_left(self): # Vyvoláno p?i tažení prstu doleva na obrazovkách obsahující # GestureListener self.sm.transition = SlideTransition(direction="left") if self.sm.current_screen.name == "StatsScreen": self.sm.current = "PartylineScreen" elif self.sm.current_screen.name == "PartylineScreen": if self.sm.current_screen.input.focus: self.sm.current_screen.input.focus = False self.chat.unread.opacity = 0 self.chat.text = "" self.sm.current = "GameScreen" print "< swipe left >"
def build(self): self.create_protocol() sm = ScreenManager(transition=SlideTransition()) sm.add_widget(MainScreen(name='controller', protocol=self.protocol, screen_manager=sm)) sm.add_widget(NodesScreen(name='nodes', screen_manager=sm)) log.msg("%s" % self.get_application_config()) return sm
def __init__(self, **kvargs): super(Program, self).__init__(**kvargs) Window.bind(on_keyboard=self.events_program) # ??? ??????? ????????? ? programclass. self.Screen = Screen self.Clock = Clock self.CustomMenuItem = CustomMenuItem self.KDialog = KDialog self.BDialog = BDialog self.Manifest = Manifest self.SwapTransition = SwapTransition self.choice = choice self.get_color_from_hex = get_color_from_hex self.get_hex_from_color = get_hex_from_color self.core = core self.name_program = core.string_lang_title self.navigation_drawer = NavigationDrawer(side_panel_width=230) self.current_open_tab = core.string_lang_tabbed_menu_shops self.shop = False # ????????? ??????? self.open_dialog = False # ??????? ?????????? ???? self.effects_transition = (SlideTransition, SwapTransition) # ?????? ?????????. self.shops = core.dict_shops.keys() # ?????? ???????. self.locations = [ location.split('.')[0].lower() for location in os.listdir( '{}/Data/Images/locations'.format(core.prog_path))]
def regresar(self): self.manager.transition = SlideTransition(direction="right") self.manager.current = 'inicio'
def disconnect(self): self.manager.transition = SlideTransition(direction="right") self.manager.current = 'login' self.manager.get_screen('login').resetForm()
def signOut(self): localFiles.saveUserInfoLocally(userID=0, userIPaddress=0, userName="No name", userNickname="No Nickname") self.manager.transition = SlideTransition(direction="left") self.manager.current = 'inicio'
def do_registrar(self, userName, userNickName, userPassword): a = SnapDB() if userName == "" or userNickName == "" or userPassword == "": popup = Popup(title='Missing fields', content=Label(text='You\'re missing some fields, try again.'), size_hint=(None, None), size=(350, 200)) popup.open() else: a.addUser(name=userName, nickName=userNickName, password=userPassword) app = App.get_running_app() self.manager.transition = SlideTransition(direction="left") self.manager.current = 'login'
def do_inicio(self): app = App.get_running_app() self.manager.transition = SlideTransition(direction="left") self.manager.current = 'login'
def do_registrar(self): app = App.get_running_app() self.manager.transition = SlideTransition(direction="right") self.manager.current = 'registrar'