久久久久久久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ì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我對(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í)例開(kāi)始的游戲.當(dāng)游戲打開(kāi)時(shí),Popup 類被打開(kāi).事件發(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)擊彈窗上的開(kāi)始按鈕
                  2. 方法 start_click() 運(yùn)行
                  3. 調(diào)用Controller實(shí)例中的start_game()方法
                  4. 這又將原始控制器實(shí)例中的游戲狀態(tài)更改為真"

                  我的問(wèn)題在于第 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)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(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>

                          • 主站蜘蛛池模板: 天天操天天看 | 97人人插| 日韩一级黄色片 | 成人在线免费观看网站 | 玖玖在线观看 | 成人自拍网 | 天堂av中文在线 | 老司机午夜免费精品视频 | 日韩视频免费大全中文字幕 | 久久久久久久久国产 | 欧美成人午夜 | 黄色福利视频 | 日日干日日射 | 国产欧美一区二区精品性色超碰 | 成人羞羞国产免费游戏 | 亚洲精品字幕在线观看 | 三级黄色片免费看 | 夜夜操影院| 亚洲欧美一区二区三区在线 | 亚洲欧美日韩精品 | 超碰在线成人 | 久久艳片www.17c.com | 一区二区在线视频 | 日韩在线视频播放 | 久久在线视频 | 成人在线视频免费 | 国产欧美视频在线观看 | 亚洲黄色一级 | www.99色 | av大片在线观看 | 一级片av | 丰满岳乱妇一区二区 | 欧美一级片免费看 | 欧美日韩国产一区二区 | 玖草在线| 国产一级在线视频 | 午夜精品久久久久久 | 中文字幕在线观 | 日韩一区二区视频 | 国产福利在线视频 | 精品|