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

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

    1. <tfoot id='2APzy'></tfoot>
    2. <legend id='2APzy'><style id='2APzy'><dir id='2APzy'><q id='2APzy'></q></dir></style></legend>
    3. <small id='2APzy'></small><noframes id='2APzy'>

        <bdo id='2APzy'></bdo><ul id='2APzy'></ul>

        ObjectProperty 類的使用

        Usage of ObjectProperty class(ObjectProperty 類的使用)
                <tbody id='hnyqU'></tbody>

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

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

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

                • 本文介紹了ObjectProperty 類的使用的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我剛開始學(xué)習(xí) kivy,我對(duì) ObjectProperty 類的用法以及它如何將 None 作為參數(shù)感到非常困惑.有人可以解釋一下嗎?我在 kivy 教程中找到的:

                  I Just started to learn kivy and I am very confused on the usage of the ObjectProperty class, and how it takes None as an argument. Could somebody explain it please? I found it in the kivy tutorial:

                  class PongGame(Widget):
                      ball = ObjectProperty(None)
                  
                      def update(self, dt):
                          self.ball.move()
                  
                          # bounce off top and bottom
                          if (self.ball.y < 0) or (self.ball.top > self.height):
                              self.ball.velocity_y *= -1
                  
                          # bounce off left and right
                          if (self.ball.x < 0) or (self.ball.right > self.width):
                              self.ball.velocity_x *= -1
                  

                  推薦答案

                  Kivy Property 是一個(gè)類似于 Python 自己的 property 的便利類,但也提供類型檢查,驗(yàn)證和事件.ObjectPropertyProperty 類的一個(gè)特殊子類,因此它具有與它相同的初始化參數(shù):

                  The Kivy Property is a convenience class similar to Python's own property but that also provides type checking, validation and events. ObjectProperty is a specialised sub-class of the Property class, so it has the same initialisation parameters as it:

                  默認(rèn)情況下,屬性始終采用默認(rèn)值[.] 默認(rèn)值value 必須是與 Property 類型一致的值.例如,您不能將列表設(shè)置為 StringProperty,因?yàn)?StringProperty將檢查默認(rèn)值.

                  By default, a Property always takes a default value[.] The default value must be a value that agrees with the Property type. For example, you can’t set a list to a StringProperty, because the StringProperty will check the default value.

                  None 是一種特殊情況:您可以將 Property 的默認(rèn)值設(shè)置為無,但您不能在之后將 None 設(shè)置為屬性.如果你真的想要這樣做,您必須使用 allownone=True[.]

                  None is a special case: you can set the default value of a Property to None, but you can’t set None to a property afterward. If you really want to do that, you must declare the Property with allownone=True[.]

                  (來自 Kivy 屬性文檔)

                  (from the Kivy Property documentation)

                  在您的代碼中,PongGame 有一個(gè) ball 屬性,該屬性最初設(shè)置為 None,稍后將被分配一個(gè)球?qū)ο?這是在 kv 文件中定義的:

                  In your code, PongGame has a ball property that is initially set to None and will later be assigned a ball object. This is defined in the kv file:

                  <PongGame>:
                      ball: pong_ball
                  
                      PongBall:
                          id: pong_ball
                          center: self.parent.center
                  

                  因?yàn)闆]有對(duì)象被傳遞給初始化器,所以 任何 對(duì)象都可以分配給該屬性.您可以通過使用虛擬值對(duì)其進(jìn)行初始化來將其限制為僅容納球?qū)ο?

                  Because no object was passed to the initialiser, any object can be assigned to that property. You could restrict it to only hold ball objects by initialising it with a dummy value:

                  ball = ObjectProperty(PongBall())
                  

                  這篇關(guān)于ObjectProperty 類的使用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個(gè)在 Python 中提供角色的不和諧機(jī)器人?)
                  Discord bot isn#39;t responding to commands(Discord 機(jī)器人沒有響應(yīng)命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?Discord 機(jī)器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機(jī)器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動(dòng)更改角色顏色)
                • <i id='AdWeq'><tr id='AdWeq'><dt id='AdWeq'><q id='AdWeq'><span id='AdWeq'><b id='AdWeq'><form id='AdWeq'><ins id='AdWeq'></ins><ul id='AdWeq'></ul><sub id='AdWeq'></sub></form><legend id='AdWeq'></legend><bdo id='AdWeq'><pre id='AdWeq'><center id='AdWeq'></center></pre></bdo></b><th id='AdWeq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AdWeq'><tfoot id='AdWeq'></tfoot><dl id='AdWeq'><fieldset id='AdWeq'></fieldset></dl></div>
                  • <bdo id='AdWeq'></bdo><ul id='AdWeq'></ul>

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

                          <tbody id='AdWeq'></tbody>

                            <tfoot id='AdWeq'></tfoot>
                          1. <legend id='AdWeq'><style id='AdWeq'><dir id='AdWeq'><q id='AdWeq'></q></dir></style></legend>
                            主站蜘蛛池模板: av手机在线看| 免费同性女女aaa免费网站 | 夜夜操天天干 | 美女天天操 | 亚洲二区在线 | 日本不卡视频 | 日韩精品在线一区 | 狠狠操在线 | 国产精品久久久久久一区二区三区 | 日韩成人免费视频 | 久久免费国产 | 国产精品久久福利 | 亚洲欧美日本在线 | 超碰导航| 久久99视频这里只有精品 | 国产91av视频在线观看 | 极品电影院 | 激情福利视频 | 精品国产一级 | 色婷婷综合久久久中文字幕 | v片网站| 在线第一页 | 中文字幕第十一页 | 91 中文字幕| 亚洲欧美综合 | 超碰免费在线观看 | 午夜欧美| 日韩国产免费观看 | 99re在线观看 | 亚洲高清视频在线观看 | 高清免费在线 | 免费永久av | 久久se精品一区精品二区 | 成年人免费看的视频 | av一级久久 | 男人的天堂中文字幕 | 免费麻豆视频 | 免费观看一级毛片 | 国产精品久久久久国产a级 欧美日韩国产免费 | 欧美精品久久 | 亚洲综合久久网 |