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

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

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

        <tfoot id='TZfLJ'></tfoot>

        • <bdo id='TZfLJ'></bdo><ul id='TZfLJ'></ul>
      2. <legend id='TZfLJ'><style id='TZfLJ'><dir id='TZfLJ'><q id='TZfLJ'></q></dir></style></legend>
      3. 從現(xiàn)有實(shí)例調(diào)用方法

        Calling a method from an existing instance(從現(xiàn)有實(shí)例調(diào)用方法)
          <bdo id='wBUhV'></bdo><ul id='wBUhV'></ul>
              <tbody id='wBUhV'></tbody>

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

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

                • <legend id='wBUhV'><style id='wBUhV'><dir id='wBUhV'><q id='wBUhV'></q></dir></style></legend>

                  本文介紹了從現(xiàn)有實(shí)例調(diào)用方法的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我對(duì)面向?qū)ο缶幊痰睦斫庥悬c(diǎn)不穩(wěn)定,所以如果你有任何鏈接可以幫助解釋這些概念,我會(huì)很高興看到它們!

                  My understanding of Object Orientated Programming is a little shaky so if you have any links that would help explain the concepts it would be great to see them!

                  我已經(jīng)稍微縮短了代碼.基本原則是我有一個(gè)以主 Controller 類的實(shí)例開始的游戲.當(dāng)游戲打開時(shí),Popup 類被打開.事件發(fā)生如下:

                  I've shortened the code somewhat. The basic principle is that I have a game that starts with an instance of the main Controller class. When the game is opened the Popup class is opened. The events happens as follows:

                  1. 點(diǎn)擊彈窗上的開始按鈕
                  2. 方法 start_click() 運(yùn)行
                  3. 調(diào)用Controller實(shí)例中的start_game()方法
                  4. 這又將原始控制器實(shí)例中的游戲狀態(tài)更改為真"

                  我的問題在于第 3 步.我收到的錯(cuò)誤消息是:

                  My problem is with step 3. The error message I get is:

                  TypeError: unbound method start_game() must be called with Controller 
                  instance as first argument (got nothing instead)
                  

                  我想 StartPopUp 類中需要對(duì) Controller 類進(jìn)行一些引用.但我不太明白如何創(chuàng)建該參考?

                  I guess there needs to be some reference to the Controller class in the StartPopUp class. But I don't quite understand how to create that reference?

                  import kivy
                  kivy.require('1.8.0')
                  
                  from kivy.app import App
                  from kivy.uix.widget import Widget
                  from kivy.clock import Clock
                  from kivy.properties import BooleanProperty, NumericProperty, ObjectProperty
                  from kivy.uix.popup import Popup
                  from kivy.lang import Builder
                  
                  Builder.load_string('''
                  <StartPopUp>            
                      size_hint: .2, .2
                      auto_dismiss: False
                      title: 'Welcome'
                      Button:
                          text: 'Play'
                          on_press: root.start_click()
                          on_press: root.dismiss()
                  
                  ''')
                  
                  class StartPopUp(Popup):
                  
                      def __init__(self, **kw):
                          super(StartPopUp, self).__init__(**kw)
                  
                      def start_click(self):
                          Controller.start_game()                    
                  
                  class Controller(Widget):
                      playing_label = BooleanProperty(False)          #Intitial phase of game is off
                  
                      def __init__(self, **kw):
                          super(Controller, self).__init__(**kw)        
                  
                      def start_popup(self, dt):    
                          sp = StartPopUp()
                          sp.open()
                  
                      def start_game(self):
                          self.playing_label = True
                          print self.playing_label   
                  
                  class MoleHuntApp(App):
                  
                      def build(self):
                          game = Controller()
                          Clock.schedule_once(game.start_popup, 1)
                          return game
                  
                  if __name__ == '__main__':
                      MoleHuntApp().run() 
                  

                  提前致謝!

                  推薦答案

                  可以這樣傳遞實(shí)例

                  class StartPopUp(Popup):
                  
                      def __init__(self, controller, **kw):
                          super(StartPopUp, self).__init__(**kw)
                          self.controller = controller
                  
                      def start_click(self):
                          self.controller.start_game()
                  

                  在控制器中

                  def start_popup(self, dt):    
                      sp = StartPopUp(self)
                      sp.open()
                  

                  這篇關(guān)于從現(xiàn)有實(shí)例調(diào)用方法的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測(cè)位置提供者?GPS 或網(wǎng)絡(luò)提供商)
                  Get current location during app launch(在應(yīng)用啟動(dòng)期間獲取當(dāng)前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

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

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

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

                        <tbody id='Arr6p'></tbody>
                        <legend id='Arr6p'><style id='Arr6p'><dir id='Arr6p'><q id='Arr6p'></q></dir></style></legend>

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

                          • 主站蜘蛛池模板: 天天干天天色 | 成人亚洲视频 | 日韩有码在线观看 | 91久久久久久 | 日本高清视频网站 | 天堂精品 | 亚洲国产一区二区在线 | 日韩国产欧美一区 | 久久久999国产精品 中文字幕在线精品 | 日韩精品在线观看网站 | 91亚洲国产成人久久精品网站 | 日韩精品在线看 | 一区二区三区高清不卡 | 国产精品成人久久久久 | 欧美一级www片免费观看 | 亚洲免费成人 | 久久亚洲春色中文字幕久久久 | 日韩在线精品视频 | 亚洲二区在线 | 久久久久国产一区二区三区四区 | 二区国产| www久久av | 亚洲成人免费视频在线观看 | 国产高清一区二区三区 | 欧美区在线 | 成人一区二区三区在线观看 | av在线播放网 | 欧美久久久久久久久中文字幕 | 亚洲精品68久久久一区 | 国产精品一区二区三区在线播放 | 91看片在线观看 | 国产一区二区三区久久久久久久久 | 亚洲福利精品 | 国产乱一区二区三区视频 | 免费一级毛片 | 亚洲自拍偷拍欧美 | 日韩视频精品在线 | 亚州综合在线 | 日本a级大片 | 手机日韩 | 国产丝袜一区二区三区免费视频 |