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

      1. <tfoot id='nXrCn'></tfoot>

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

      2. <legend id='nXrCn'><style id='nXrCn'><dir id='nXrCn'><q id='nXrCn'></q></dir></style></legend>
        • <bdo id='nXrCn'></bdo><ul id='nXrCn'></ul>
      3. <i id='nXrCn'><tr id='nXrCn'><dt id='nXrCn'><q id='nXrCn'><span id='nXrCn'><b id='nXrCn'><form id='nXrCn'><ins id='nXrCn'></ins><ul id='nXrCn'></ul><sub id='nXrCn'></sub></form><legend id='nXrCn'></legend><bdo id='nXrCn'><pre id='nXrCn'><center id='nXrCn'></center></pre></bdo></b><th id='nXrCn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nXrCn'><tfoot id='nXrCn'></tfoot><dl id='nXrCn'><fieldset id='nXrCn'></fieldset></dl></div>
      4. Python Kivy:如何在按鈕單擊時調用函數?

        Python Kivy: how to call a function on button click?(Python Kivy:如何在按鈕單擊時調用函數?)
        • <tfoot id='lZerU'></tfoot>

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

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

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

                    <tbody id='lZerU'></tbody>
                1. 本文介紹了Python Kivy:如何在按鈕單擊時調用函數?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我對使用 kivy 庫很陌生.

                  i'm pretty new at using kivy library.

                  我有一個 app.py 文件和一個 app.kv 文件,我的問題是我無法在按下按鈕時調用函數.

                  I have an app.py file and an app.kv file , my problem is that I can't call a function on button press.

                  app.py:

                  import kivy
                  from kivy.app import App
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.uix.button import Button
                  
                  class Launch(BoxLayout):
                      def __init__(self, **kwargs):
                          super(Launch, self).__init__(**kwargs)
                  
                      def say_hello(self):
                          print "hello"
                  
                  
                  class App(App):
                      def build(self):
                          return Launch()
                  
                  
                  if __name__ == '__main__':
                      App().run()
                  

                  app.kv:

                  #:kivy 1.9.1
                  
                  <Launch>:
                      BoxLayout:
                          Button:
                              size:(80,80)
                              size_hint:(None,None)
                              text:"Click me"
                              on_press: say_hello
                  

                  推薦答案

                  Mode:.kv

                  很簡單,say_hello 屬于 Launch 類,所以要在 .kv 文件中使用它,你必須編寫 <代碼>root.say_hello.請注意,say_hello 是您要執行的函數,因此您不必忘記 () ---> root.say_hello().

                  Mode:.kv

                  It's very simple, say_hello belongs to the Launch class so in order to use it in your .kv file you have to write root.say_hello. Note that say_hello is a function that you want to execute so you don't have to forget the () ---> root.say_hello().

                  另外,如果 say_helloApp 類中,您應該使用 App.say_hello() 因為它屬于應用程序.(注意:即使你的 App 類是 class MyFantasicApp(App): 它總是 App.say_hello()app.say_hello() 我不記得了,抱歉).

                  Also, if say_hello were in App class you should use App.say_hello() because it belongs to the app. (Note: even if your App class were class MyFantasicApp(App): it would always be App.say_hello() or app.say_hello() I don't remember, sorry).

                  #:kivy 1.9.1
                  
                  <Launch>:
                      BoxLayout:
                          Button:
                              size:(80,80)
                              size_hint:(None,None)
                              text:"Click me"
                              on_press: root.say_hello()
                  

                  模式:.py

                  你可以綁定函數.

                  from kivy.uix.button import Button # You would need futhermore this
                  class Launch(BoxLayout):
                      def __init__(self, **kwargs):
                          super(Launch, self).__init__(**kwargs)
                          mybutton = Button(
                                              text = 'Click me',
                                              size = (80,80),
                                              size_hint = (None,None)
                                            )
                          mybutton.bind(on_press = self.say_hello) # Note: here say_hello doesn't have brackets.
                          Launch.add_widget(mybutton)
                  
                      def say_hello(self):
                          print "hello"
                  

                  為什么要使用 bind?對不起,不知道.但是您在 kivy 指南中使用了它.

                  Why use bind? Sorry, no idea. But you it's used in the kivy guide.

                  這篇關于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 - 自動更改角色顏色)

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

                      <tbody id='SakMh'></tbody>
                    1. <tfoot id='SakMh'></tfoot>

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

                            主站蜘蛛池模板: 日韩久久在线 | 日韩视频在线一区 | 日韩一区不卡 | 四虎永久免费黄色影片 | 一级做a爰片久久毛片 | 一级黄色毛片 | 国产精品爱久久久久久久 | 国产精品免费一区二区 | 国产精品伦理一区 | 午夜视频在线 | 99re视频在线观看 | 国产一区二区三区四区 | 久久精品国产久精国产 | 日韩有码一区二区三区 | 91精品导航 | 国产日韩中文字幕 | 色橹橹欧美在线观看视频高清 | 欧美一区二区三区国产精品 | 国产激情91久久精品导航 | 国产日韩欧美精品一区二区 | 日本成人中文字幕在线观看 | 久久91精品| 激情欧美一区二区三区 | 成人av网站在线观看 | 亚洲天堂久久新 | 日本欧美在线观看视频 | 五月天婷婷激情 | 成人高清视频在线观看 | 亚洲视频一区在线 | 色毛片| 精品视频一区二区三区 | 国产精品国产成人国产三级 | 91精品国产高清一区二区三区 | 日本又色又爽又黄的大片 | 精品伊人久久 | 欧美综合一区 | 国产乱码精品1区2区3区 | 午夜视频精品 | 怡红院免费的全部视频 | 免费观看黄a一级视频 | 亚洲国内精品 |