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

  • <small id='MhQ6H'></small><noframes id='MhQ6H'>

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

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

        <legend id='MhQ6H'><style id='MhQ6H'><dir id='MhQ6H'><q id='MhQ6H'></q></dir></style></legend>

        如何使用python更改kivy語言中標簽的文本

        How to change text of a label in the kivy language with python(如何使用python更改kivy語言中標簽的文本)

              <small id='n9yS7'></small><noframes id='n9yS7'>

              <i id='n9yS7'><tr id='n9yS7'><dt id='n9yS7'><q id='n9yS7'><span id='n9yS7'><b id='n9yS7'><form id='n9yS7'><ins id='n9yS7'></ins><ul id='n9yS7'></ul><sub id='n9yS7'></sub></form><legend id='n9yS7'></legend><bdo id='n9yS7'><pre id='n9yS7'><center id='n9yS7'></center></pre></bdo></b><th id='n9yS7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='n9yS7'><tfoot id='n9yS7'></tfoot><dl id='n9yS7'><fieldset id='n9yS7'></fieldset></dl></div>
                  <tbody id='n9yS7'></tbody>

                • <bdo id='n9yS7'></bdo><ul id='n9yS7'></ul>

                  <legend id='n9yS7'><style id='n9yS7'><dir id='n9yS7'><q id='n9yS7'></q></dir></style></legend>
                  <tfoot id='n9yS7'></tfoot>
                • 本文介紹了如何使用python更改kivy語言中標簽的文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想知道如何使用 Python 更改在 Kivy 語言中制作的標簽文本.就像我如何將來自 python 的用戶輸入作為 kivy 中的標簽文本一樣.(順便說一句,我在實際程序中的格式正確,但我把它粘貼到stackoverflow上搞砸了)假設我想讓代碼中的標簽文本成為python中生成的隨機數,我該怎么做?

                  I was wondering how I could change the text of a label made inside the Kivy language using Python. Like how would I have user input from python be made as the text of a label in kivy. (By the way I have the formatting correct in the actual program but I screwed up pasting it to stackoverflow) Say if I wanted to make the text of the label in from the code be a random number generated in python how would I go about doing that?

                  from kivy.app import App
                  from kivy.lang import Builder
                  from kivy.uix.screenmanager import ScreenManager, Screen
                  from kivy.graphics import Color, Rectangle
                  from kivy.properties import ObjectProperty
                  
                  # Create both screens. Please note the root.manager.current: this is how
                  # you can control the ScreenManager from kv. Each screen has by default a
                  # property manager that gives you the instance of the ScreenManager used.
                  
                  
                  Builder.load_string("""
                  <ButImage@ButtonBehavior+AsyncImage>
                  <TutImage@ButtonBehavior+AsyncImage>
                  <MenuScreen>:
                  GridLayout:
                      cols: 4
                      row_force_default: True
                      col_default_width: 175
                      row_default_height: 150
                      padding: 15
                      spacing: 15
                      canvas.before:
                          BorderImage:
                              # BorderImage behaves like the CSS BorderImage
                              border: 10, 10, 10, 10
                              source: '/Users/clayhigh/Desktop/kivy/aot.png'
                              pos: self.pos
                              size: self.size
                      Button:
                          text: 'Goto settings'
                          background_color: 1,0,0,0.5
                          on_press: root.manager.current = 'settings'
                      ButImage:
                          on_press: root.manager.current = 'UBW'
                          id: but
                          size_hint: .5, .5
                          opacity: 1 if self.state == 'normal' else .5
                          allow_stretch: True
                          keep_ratio: False
                          source: 'http://s3.amazonaws.com/rapgenius/1361742626_beautiful-ocean-beautiful-pictures-27115524-1440-900.jpg'
                          Label:
                              center: but.center
                              text: "UBW"
                              color: 0.78,0.145,0.016,2
                      ButImage:
                          id: lh
                          size_hint: .5, .5
                          opacity: 1 if self.state == 'normal' else .5
                          allow_stretch: True
                          keep_ratio: False
                          source: 'http://s3.amazonaws.com/rapgenius/1361742626_beautiful-ocean-beautiful-pictures-27115524-1440-900.jpg'
                          Label:
                              center: lh.center
                              text: "LH 2"
                              color: 0,0,0,1
                      ButImage:
                          id: ttl
                          size_hint: .5, .5
                          opacity: 1 if self.state == 'normal' else .5
                          allow_stretch: True
                          keep_ratio: False
                          source: 'http://s3.amazonaws.com/rapgenius/1361742626_beautiful-ocean-beautiful-pictures-27115524-1440-900.jpg'
                          Label:
                              center: ttl.center
                              text: "TwTl"
                              color: 0,0,0,1
                      ButImage:
                          id: gris
                          size_hint: .5, .5
                          opacity: 1 if self.state == 'normal' else .5
                          allow_stretch: True
                          keep_ratio: False
                          source: 'http://s3.amazonaws.com/rapgenius/1361742626_beautiful-ocean-beautiful-pictures-27115524-1440-900.jpg'
                          Label:
                              center: gris.center
                              text: "Gris"
                              color: 0,0,0,1
                      ButImage:
                          id: shig
                          size_hint: .5, .5
                          opacity: 1 if self.state == 'normal' else .5
                          allow_stretch: True
                          keep_ratio: False
                          source: 'http://s3.amazonaws.com/rapgenius/1361742626_beautiful-ocean-beautiful-pictures-27115524-1440-900.jpg'
                          Label:
                              center: shig.center
                              text: "Shig"
                              color: 0,0,0,1
                      Button:
                          text: 'Test3'
                          background_color: 1,0,0,0.5
                      Button:
                          text: 'Test4'
                          background_color: 1,0,0,0.5
                      Button:
                          text: 'Quit'
                          background_color: 1,0,0,0.5
                          on_press: App.on_stop
                  
                  <SettingsScreen>:
                  GridLayout:
                      row_force_default: True
                      row_default_height: 100
                      cols: 2
                      canvas.before:
                          BorderImage:
                              # BorderImage behaves like the CSS BorderImage
                              border: 10, 10, 10, 10
                              source: '/Users/clayhigh/Desktop/kivy/ato.jpeg'
                              pos: self.pos
                              size: self.size
                      Button:
                          text: 'Button'
                          color: 0,0,.5
                          background_color: 1,0,0,1
                      Button:
                          text: 'Back to menu'
                          background_color: 1,0,0,1
                          on_press: root.manager.current = 'menu'
                  <UBW>:
                  GridLayout:
                      row_force_default: True
                      row_default_height: 100
                      cols: 2
                      canvas.before:
                          Color:
                              rgb: .5, .5, .5
                          Rectangle:
                              pos: self.pos
                              size: self.size
                          Color:
                              rgb: 1, 1, 1
                          BorderImage:
                              # BorderImage behaves like the CSS BorderImage
                              border: 10, 10, 10, 10
                              source: '/Users/clayhigh/Desktop/kivy/fsn.jpg'
                              pos: self.pos
                              size: self.size
                      Button:
                          text: 'Back to menu'
                          color: 0,0,.5
                          on_press: root.manager.current = 'menu'
                          background_color: 1,0,0,1
                      Label:
                          id: AName
                          text: "F S/N: UBW"
                          font_size: '24sp'
                  """)
                  
                  # Declare both screens
                  
                  
                  class MenuScreen(Screen):
                  pass
                  
                  
                  class SettingsScreen(Screen):
                  pass
                  
                  
                  class UBW(Screen):
                  pass
                  
                  # Create the screen manager
                  sm = ScreenManager()
                  sm.add_widget(MenuScreen(name='menu'))
                  sm.add_widget(SettingsScreen(name='settings'))
                  sm.add_widget(UBW(name='UBW'))
                  
                  
                  class TestApp(App):
                  
                  def build(self):
                      return sm
                  
                  if __name__ == '__main__':
                  TestApp().run()
                  

                  推薦答案

                  標簽的文本可以是 kivy 屬性,以后可以更改,因為它是 kivy 屬性,所以它會在任何地方自動更新.這是您的 .py 示例

                  Text of a label can be a kivy property, which can be later changed and since it is a kivy property it will automatically updated everywhere. Here is an example of your .py

                  from kivy.app import App
                  from kivy.uix.widget import Widget
                  from kivy.properties import StringProperty
                  import random
                  
                  class YourWidget(Widget):
                      random_number = StringProperty()
                  
                      def __init__(self, **kwargs):
                          super(YourWidget, self).__init__(**kwargs)
                          self.random_number = str(random.randint(1, 100))
                  
                      def change_text(self):
                          self.random_number = str(random.randint(1, 100))
                  
                  class YourApp(App):
                      def build(self):
                          return YourWidget()
                  
                  if __name__ == '__main__':
                      YourApp().run()
                  

                  還有你的 .kv

                  <YourWidget>:
                      BoxLayout:
                          size: root.size
                          Button:
                              id: button1
                              text: "Change text"
                              on_release: root.change_text()
                          Label:
                              id: label1
                              text: root.random_number
                  

                  當你點擊按鈕時,它會調用change_text()函數,該函數會將標簽的文本隨機更改為1到100之間的隨機整數.

                  When you click the button, it will call change_text() function, which will randomly change the text of the label to random integer between 1 and 100.

                  這篇關于如何使用python更改kivy語言中標簽的文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)
                    <tbody id='WMyNd'></tbody>
                  <i id='WMyNd'><tr id='WMyNd'><dt id='WMyNd'><q id='WMyNd'><span id='WMyNd'><b id='WMyNd'><form id='WMyNd'><ins id='WMyNd'></ins><ul id='WMyNd'></ul><sub id='WMyNd'></sub></form><legend id='WMyNd'></legend><bdo id='WMyNd'><pre id='WMyNd'><center id='WMyNd'></center></pre></bdo></b><th id='WMyNd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WMyNd'><tfoot id='WMyNd'></tfoot><dl id='WMyNd'><fieldset id='WMyNd'></fieldset></dl></div>

                        <bdo id='WMyNd'></bdo><ul id='WMyNd'></ul>
                        • <legend id='WMyNd'><style id='WMyNd'><dir id='WMyNd'><q id='WMyNd'></q></dir></style></legend>

                          <tfoot id='WMyNd'></tfoot>

                          1. <small id='WMyNd'></small><noframes id='WMyNd'>

                            主站蜘蛛池模板: 国产2区 | 久久国产成人午夜av影院武则天 | 中文字幕第十一页 | 国产精品18毛片一区二区 | 欧美久久久网站 | 一区二区三区视频在线 | 亚洲成人国产 | 在线观看成人 | www.国产 | 中文在线日韩 | 欧美一区二区三区久久精品 | 激情网站在线观看 | 一区二区三区国产 | 日韩一区av | 日韩视频91 | 在线观看欧美日韩视频 | 成年人在线观看视频 | 亚洲国产网 | 一区二区三区在线免费观看视频 | 成人午夜影院 | 性视频网 | 欧美成人一区二区三区片免费 | 一级毛片视频在线 | 日韩欧美国产精品一区二区三区 | 久久久久久久久综合 | 精品婷婷 | 中文字幕av色 | 成人在线一区二区 | 国产亚洲一区二区精品 | 精品久久影院 | 这里精品 | 欧美视频精品 | 亚洲欧洲精品在线 | 亚洲一区二区精品视频 | 在线视频 欧美日韩 | 国产免费拔擦拔擦8x高清 | 蜜桃在线视频 | 亚洲一区二区三区在线播放 | 成人午夜精品 | 中文字幕亚洲一区 | 国产精品国产a级 |