久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='RvoqV'><tr id='RvoqV'><dt id='RvoqV'><q id='RvoqV'><span id='RvoqV'><b id='RvoqV'><form id='RvoqV'><ins id='RvoqV'></ins><ul id='RvoqV'></ul><sub id='RvoqV'></sub></form><legend id='RvoqV'></legend><bdo id='RvoqV'><pre id='RvoqV'><center id='RvoqV'></center></pre></bdo></b><th id='RvoqV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RvoqV'><tfoot id='RvoqV'></tfoot><dl id='RvoqV'><fieldset id='RvoqV'></fieldset></dl></div>
    <tfoot id='RvoqV'></tfoot>
        <bdo id='RvoqV'></bdo><ul id='RvoqV'></ul>
    1. <small id='RvoqV'></small><noframes id='RvoqV'>

      <legend id='RvoqV'><style id='RvoqV'><dir id='RvoqV'><q id='RvoqV'></q></dir></style></legend>
      1. Kivy:從python代碼改變屏幕

        Kivy: changing screen from python code(Kivy:從python代碼改變屏幕)
        <tfoot id='pueHL'></tfoot>

        1. <i id='pueHL'><tr id='pueHL'><dt id='pueHL'><q id='pueHL'><span id='pueHL'><b id='pueHL'><form id='pueHL'><ins id='pueHL'></ins><ul id='pueHL'></ul><sub id='pueHL'></sub></form><legend id='pueHL'></legend><bdo id='pueHL'><pre id='pueHL'><center id='pueHL'></center></pre></bdo></b><th id='pueHL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pueHL'><tfoot id='pueHL'></tfoot><dl id='pueHL'><fieldset id='pueHL'></fieldset></dl></div>
              <bdo id='pueHL'></bdo><ul id='pueHL'></ul>
              <legend id='pueHL'><style id='pueHL'><dir id='pueHL'><q id='pueHL'></q></dir></style></legend>
            • <small id='pueHL'></small><noframes id='pueHL'>

                    <tbody id='pueHL'></tbody>

                • 本文介紹了Kivy:從python代碼改變屏幕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在組裝一個 Kivy 應用程序,但在解決如何在 python 代碼中任意選擇的點更改屏幕時遇到了一些問題.

                  I'm putting together a Kivy app and am having some problems working out how to change screens at an arbitrarily chosen point within the python code.

                  在下面的例子中,我想知道如何通過執行一個函數 my main.pyScreen2 切換回 Screen1文件.

                  In the following example, I would like to know how to switch from Screen2 back to Screen1 by executing a function my main.py file.

                  這是我的 main.py:

                  # -*- coding: utf-8 -*-
                  
                  from kivy.app import App
                  from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
                  from kivy.properties import ObjectProperty
                  from functools import partial
                  
                  import random
                  import time
                  
                  class ScreenOne(Screen):
                      pass
                  
                  class ScreenTwo(Screen):
                  
                      def __init__(self,**kwargs):
                          super(ScreenTwo, self).__init__(**kwargs)
                          self.displayScreenThenLeave()
                  
                      def displayScreenThenLeave(self):
                          # 'time.sleep(3)' is a stand-in for "execute some code here"
                          time.sleep(3)
                          self.changeScreen()
                  
                      # I want this function to send the user back to ScreenOne.
                      def changeScreen(self):
                          pass
                  
                  class Manager(ScreenManager):
                  
                      screen_one = ObjectProperty(None)
                      screen_two = ObjectProperty(None)
                  
                  class ScreensApp(App):
                  
                      def build(self):
                          m = Manager(transition=NoTransition())
                          return m
                  
                  if __name__ == "__main__":
                      ScreensApp().run()
                  

                  這是我的 screens.kv:

                  #:kivy 1.8.0
                  
                  <ScreenOne>:
                  
                      BoxLayout:
                          orientation: "vertical"
                          size: root.size
                          spacing: 20
                          padding: 20
                  
                          Label:
                              text: "Main Menu"
                          Button:
                              text: "Button 1"
                              on_release: root.manager.current = "screen2"
                  
                  <ScreenTwo>:        
                  
                      BoxLayout:
                          orientation: "vertical"
                          size: root.size
                          spacing: 20
                          padding: 20
                  
                          Label:
                              id: label
                              text: "Welcome to Screen 2, please wait three seconds"
                  
                  <Manager>:
                      id: screen_manager
                  
                      screen_one: screen_one
                      screen_two: screen_two
                  
                      ScreenOne:
                          id: screen_one
                          name: "screen1"
                          manager: screen_manager
                  
                      ScreenTwo:
                          id: screen_two
                          name: "screen2"
                          manager: screen_manager
                  

                  應該很明顯,我是 Kivy 的初學者,所以如果你能告訴我我需要更改的確切內容,包括應該使用的特定語法,我將不勝感激.

                  As should be pretty evident, I'm a total beginner at Kivy, so I'd really appreciate it if you could show me exactly what I need to change, including the specific syntax that should be used.

                  提前感謝您的時間和智慧.

                  Thanks in advance for your time and wisdom.

                  推薦答案

                  這是一個基于您的附加信息的簡單游戲"示例.當玩家進入游戲畫面時,他們的生命值正在流血.當池達到零時,它們被送回菜單屏幕.

                  Here is a simple 'game' example based on your additional info. When a player enters the game screen, their health points are bleeding. When the pool reaches zero, they are sent back to menu screen.

                  main.py:

                  #!/usr/bin/env python
                  # -*- coding: utf-8 -*-
                  
                  from kivy.app import App
                  from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
                  from kivy.properties import ObjectProperty, NumericProperty
                  
                  import time
                  import threading
                  
                  
                  class ScreenOne(Screen):
                      pass
                  
                  
                  class ScreenTwo(Screen):
                      health_points = NumericProperty(100)
                  
                      def __init__(self, **kwargs):
                          super(ScreenTwo, self).__init__(**kwargs)
                  
                      def on_health_points(self, instance, value):
                          if value < 1:
                              self.changeScreen()
                  
                      def on_enter(self, *args):
                          thread = threading.Thread(target=self.bleed)
                          thread.daemon = True
                          thread.start()
                  
                      def bleed(self, *args):
                          while self.health_points > 0:
                              self.health_points -= 5
                              time.sleep(0.1)
                  
                      def displayScreenThenLeave(self):
                          self.changeScreen()
                  
                      def changeScreen(self):
                          if self.manager.current == 'screen1':
                              self.manager.current = 'screen2'
                          else:
                              self.manager.current = 'screen1'
                  
                  
                  class Manager(ScreenManager):
                  
                      screen_one = ObjectProperty(None)
                      screen_two = ObjectProperty(None)
                  
                  
                  class ScreensApp(App):
                  
                      def build(self):
                          m = Manager(transition=NoTransition())
                          return m
                  
                  if __name__ == "__main__":
                      ScreensApp().run()
                  

                  screens.kv:

                  screens.kv:

                  #:kivy 1.8.0
                  
                  <ScreenOne>:
                  
                      BoxLayout:
                          orientation: "vertical"
                          size: root.size
                          spacing: 20
                          padding: 20
                  
                          Label:
                              text: "Main Menu"
                          Button:
                              text: "Button 1"
                              on_release:
                                  root.manager.current = "screen2"
                                  # reset health_points
                                  root.manager.ids.screen_two.health_points = 100
                  
                  <ScreenTwo>:        
                  
                      BoxLayout:
                          orientation: "vertical"
                          size: root.size
                          spacing: 20
                          padding: 20
                  
                          Label:
                              id: label
                              text: "health points: " + str(root.health_points)
                  
                  <Manager>:
                      id: screen_manager
                  
                      screen_one: screen_one
                      screen_two: screen_two
                  
                      ScreenOne:
                          id: screen_one
                          name: "screen1"
                          manager: screen_manager
                  
                      ScreenTwo:
                          id: screen_two
                          name: "screen2"
                          manager: screen_manager
                  

                  這篇關于Kivy:從python代碼改變屏幕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                        <legend id='hvbvW'><style id='hvbvW'><dir id='hvbvW'><q id='hvbvW'></q></dir></style></legend>
                        <i id='hvbvW'><tr id='hvbvW'><dt id='hvbvW'><q id='hvbvW'><span id='hvbvW'><b id='hvbvW'><form id='hvbvW'><ins id='hvbvW'></ins><ul id='hvbvW'></ul><sub id='hvbvW'></sub></form><legend id='hvbvW'></legend><bdo id='hvbvW'><pre id='hvbvW'><center id='hvbvW'></center></pre></bdo></b><th id='hvbvW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hvbvW'><tfoot id='hvbvW'></tfoot><dl id='hvbvW'><fieldset id='hvbvW'></fieldset></dl></div>
                        <tfoot id='hvbvW'></tfoot>
                      1. <small id='hvbvW'></small><noframes id='hvbvW'>

                          <bdo id='hvbvW'></bdo><ul id='hvbvW'></ul>

                              <tbody id='hvbvW'></tbody>

                            主站蜘蛛池模板: 午夜视频在线观看网址 | 亚洲午夜网 | 蜜臀久久 | 毛片a级| 亚洲视频在线看 | 极品在线| 91日b| 精品欧美一区二区三区久久久小说 | 精品久久久久国产 | 国产一区二区麻豆 | jvid精品资源在线观看 | 亚洲 欧美 另类 日韩 | 国产精品久久久久久久久久妇女 | 国产精品一区二区久久精品爱微奶 | 国产精品一区二区免费 | 亚洲欧洲精品成人久久奇米网 | 99在线国产| 日韩在线一区二区三区 | 国户精品久久久久久久久久久不卡 | 欧美4p| 国产精品天堂 | 日产久久 | 日韩激情在线 | 国产午夜一级 | 成人免费淫片aa视频免费 | 国产精品中文字幕在线 | 精精国产xxxx视频在线播放 | 视频一区二区中文字幕日韩 | 在线观看视频91 | 国产一区精品在线 | 国产精品一区二区在线播放 | 在线日韩在线 | 亚洲aⅴ| 人操人免费视频 | 日韩在线观看中文字幕 | 欧美一区二区三区在线观看 | 日韩一区二区三区在线观看视频 | 91精品国模一区二区三区 | 亚洲第一成人av | 91精品在线播放 | 国产精品久久久久久久久久免费 |