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

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

        <bdo id='qGqAr'></bdo><ul id='qGqAr'></ul>
    2. <tfoot id='qGqAr'></tfoot>
      1. <legend id='qGqAr'><style id='qGqAr'><dir id='qGqAr'><q id='qGqAr'></q></dir></style></legend>

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

        將功能綁定到 Kivy 按鈕

        Bind function to Kivy button(將功能綁定到 Kivy 按鈕)

                <small id='5ioaR'></small><noframes id='5ioaR'>

                  <tbody id='5ioaR'></tbody>
              1. <tfoot id='5ioaR'></tfoot>

                  <bdo id='5ioaR'></bdo><ul id='5ioaR'></ul>
                • <i id='5ioaR'><tr id='5ioaR'><dt id='5ioaR'><q id='5ioaR'><span id='5ioaR'><b id='5ioaR'><form id='5ioaR'><ins id='5ioaR'></ins><ul id='5ioaR'></ul><sub id='5ioaR'></sub></form><legend id='5ioaR'></legend><bdo id='5ioaR'><pre id='5ioaR'><center id='5ioaR'></center></pre></bdo></b><th id='5ioaR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5ioaR'><tfoot id='5ioaR'></tfoot><dl id='5ioaR'><fieldset id='5ioaR'></fieldset></dl></div>
                • <legend id='5ioaR'><style id='5ioaR'><dir id='5ioaR'><q id='5ioaR'></q></dir></style></legend>
                • 本文介紹了將功能綁定到 Kivy 按鈕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試將以下函數綁定到 Kivy 中的 Button.

                  I'm trying to bind the following function to a Button in Kivy.

                  def auth(self):
                      print(self.username)
                      if self.username == "Hendricko":
                          print("self.username == Hendricko")
                          popup = Popup(title="success",
                              content=Label(text="Howdy !"),
                              size=(100, 100),
                              size_hint=(0.3, 0.3),
                              auto_dismiss=False)
                          popup.open()
                  

                  我試過了

                  class Foo():
                     def initUI(self):
                      self.add_widget(Button(text="Auth User and Password", on_press=self.auth))
                  

                  但這不起作用.我做錯了什么?

                  but this doesn't work. What am I doing wrong?

                  這是我的全部代碼

                  from kivy.uix.popup import Popup
                  from kivy.app import App
                  from kivy.uix.gridlayout import GridLayout
                  from kivy.uix.label import Label
                  from kivy.uix.textinput import TextInput
                  from kivy.uix.button import Button
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.uix.stacklayout import StackLayout
                  
                  
                  class LoginScreen(GridLayout):
                      def __init__(self, **kwargs):
                          super(LoginScreen, self).__init__(**kwargs)
                          self.cols = 2
                          self.row = 2
                          self.add_widget(Label(text='User Name'))
                          self.username = TextInput(multiline=False)
                          self.add_widget(self.username)
                          self.add_widget(Label(text='password'))
                          self.password = TextInput(password=True, multiline=False)
                          self.add_widget(self.password)
                          self.hello = Button(text="hello", on_press=self.auth)
                          self.add_widget(self.hello)
                  
                      def auth(self):
                          if self.username == "Hendricko":
                              popup = Popup(title="success",
                                  content=Label(text="Howdy !"),
                                  size=(100, 100),
                                  size_hint=(0.3, 0.3),
                                  auto_dismiss=False)
                              popup.open()
                  
                  
                  class MyApp(App):
                      def build(self):
                          return LoginScreen()
                  
                  
                  if __name__ == '__main__':
                      MyApp().run()
                  

                  推薦答案

                  換行

                  self.hello = Button(text="hello", on_press=lambda a:self.auth())
                  

                  您的代碼并使用它:

                  self.hello = Button(text="hello", on_press=lambda a:self.auth())
                  

                  還在 auth 函數中添加以下行以查看它是否被調用:)

                  Also add below line in auth function to see if its called :)

                  print "auth called"
                  

                  并且有很多方法可以執行特定任務.上面的代碼將以最小的努力修復您的代碼,但是如果您想以另一種方式進行.只需使用下面的代碼.

                  and There are many ways to perform a particular task .Above code will be to fix your code in minimum effort , However If you would like to do it in another way . Just use code below .

                  from kivy.uix.popup import Popup
                  from kivy.app import App
                  from kivy.uix.gridlayout import GridLayout
                  from kivy.uix.label import Label
                  from kivy.uix.textinput import TextInput
                  from kivy.uix.button import Button
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.uix.stacklayout import StackLayout
                  
                  
                  class LoginScreen(GridLayout):
                      def __init__(self, **kwargs):
                          super(LoginScreen, self).__init__(**kwargs)
                          self.cols = 2
                          self.row = 2
                          self.add_widget(Label(text='User Name'))
                          self.username = TextInput(multiline=False)
                          self.add_widget(self.username)
                          self.add_widget(Label(text='password'))
                          self.password = TextInput(password=True, multiline=False)
                          self.add_widget(self.password)
                          self.hello = Button(text="hello")
                          self.hello.bind(on_press=self.auth)
                          self.add_widget(self.hello)
                  
                      def auth(self,instance):
                          print "auth called"
                          if self.username == "Hendricko":
                              popup = Popup(title="success",
                                  content=Label(text="Howdy !"),
                                  size=(100, 100),
                                  size_hint=(0.3, 0.3),
                                  auto_dismiss=False)
                              popup.open()
                  
                  
                  class MyApp(App):
                      def build(self):
                          return LoginScreen()
                  
                  
                  if __name__ == '__main__':
                      MyApp().run()
                  

                  這篇關于將功能綁定到 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 - 自動更改角色顏色)
                    • <bdo id='SgB0E'></bdo><ul id='SgB0E'></ul>

                    • <legend id='SgB0E'><style id='SgB0E'><dir id='SgB0E'><q id='SgB0E'></q></dir></style></legend>
                        <tbody id='SgB0E'></tbody>

                    • <tfoot id='SgB0E'></tfoot>

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

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

                          • 主站蜘蛛池模板: 逼逼视频| 国产一区在线免费观看视频 | 操一草 | 国内毛片毛片毛片毛片 | 国产一区二区三区久久久久久久久 | 成人免费网站在线 | 综合久久av | 懂色tv| 国产成人av一区二区三区 | 婷婷精品 | 中文字幕不卡在线观看 | 亚洲a视频 | 国产精品国产成人国产三级 | 羞羞视频在线观看免费观看 | 国产东北一级毛片 | 精品一区二区久久久久久久网站 | av在线免费不卡 | 精品国产一区二区三区久久久四川 | 精品久久久久一区二区国产 | 亚洲一区二区视频 | 一级黄色毛片子 | 91在线精品一区二区 | 久久久久久久久精 | 久久国产欧美一区二区三区精品 | 91美女在线观看 | 中文字幕日韩欧美 | 国产一级片 | 久久狠狠 | 久久精品国产免费 | 黄色大全免费看 | 免费a大片 | 天天综合久久 | 亚洲欧美一区二区三区视频 | av一级| 久久精品国产一区二区电影 | 日韩精品一区二区不卡 | 色视频网站在线观看 | 午夜色播 | 欧美精品一区三区 | 久久不卡| 亚洲一区在线观看视频 |