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

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

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

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

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

        python kivy AttributeError:'super'對象沒有屬性&

        python kivy AttributeError: #39;super#39; object has no attribute #39;__getattr__#39;(python kivy AttributeError:super對象沒有屬性__getattr__)

          <tbody id='YqTAs'></tbody>
        <tfoot id='YqTAs'></tfoot>
        1. <legend id='YqTAs'><style id='YqTAs'><dir id='YqTAs'><q id='YqTAs'></q></dir></style></legend>

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

                • <bdo id='YqTAs'></bdo><ul id='YqTAs'></ul>
                • <small id='YqTAs'></small><noframes id='YqTAs'>

                  本文介紹了python kivy AttributeError:'super'對象沒有屬性'__getattr__'的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  對于一個項目,我正在嘗試制作一個簡單的 GUI,它顯示一些基本信息(如時間、日期、公共交通信息、一些新聞等).為此,我想要一個顯示所有這些內容概覽的主頁以及每個主題的特殊頁面,并提供詳細視圖.Python 與 Kivy 相結合似乎是最好/最簡單的解決方案,看起來不錯,而且工作起來也很簡單.但是,我在顯示時間時遇到了問題.當我嘗試更新標簽上顯示時間的文本時,我得到一個 AttributeError: 'super' object has no attribute '__getattr__',這并沒有給我提供太多關于在哪里尋找的信息一個解法.誰能指出哪里出了問題?

                  for a project I'm trying to make a simple GUI which displays some basic information (like time, date, public transport info, some news etc.) To do this I want a Homepage that displays an overview of all these things and a special page for every subject with a detailed view. Python combined with Kivy seemed like the best/easiest solution that looks good and works quite easy. I am however getting a problem with displaying the time. When I try to update the text on the label that displays the time I get an AttributeError: 'super' object has no attribute '__getattr__', which does not give me much information as to where to look for a solution. Can anyone point out what's wrong?

                  main.py:

                  import feedparser
                  import time
                  from kivy.app import App
                  from kivy.lang import Builder
                  from kivy.uix.screenmanager import ScreenManager, Screen
                  from kivy.uix.anchorlayout import AnchorLayout
                  from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty, StringProperty
                  from kivy.uix.label import Label
                  from kivy.uix.widget import Widget
                  from kivy.clock import Clock
                  
                  # Declare widgets
                  class DateTime(Widget):
                      curtime = StringProperty('')
                  
                      def update(self, dt):
                          self.curtime = time.strftime("%H:%M:%S")
                          print self.curtime
                          self.ids["kv_timelabel"].text = str(self.curtime)
                  
                  # Declare all screens
                  class HomeScreen(Screen):
                      obj_datetime = DateTime()
                      Clock.schedule_interval(obj_datetime.update, 1.0 / 10.0)
                  
                  class NewsScreen(Screen):
                      pass
                  
                  class PublicTransportScreen(Screen):
                      pass
                  
                  class TrafficScreen(Screen):
                      pass
                  
                  class ScreenManagement(ScreenManager):
                      pass
                  
                  class MirrorApp(App):
                      def build(self):
                          # Create the screen manager
                          render = ScreenManagement()
                          render.add_widget(HomeScreen(name='home'))
                          render.add_widget(TrafficScreen(name='traffic'))
                          render.add_widget(PublicTransportScreen(name='public_transport'))
                          render.add_widget(NewsScreen(name='news'))
                          return render
                  
                  if __name__ == '__main__':
                      MirrorApp().run()
                  

                  mirror.kv:

                  #:kivy 1.9.0
                  
                  <HomeScreen>:
                      name: 'home'
                      obj_datetime: kv_datetime
                  
                      Button:
                          on_release: app.root.current = 'news'
                          text: 'News'
                          size_hint: 0.5,0.15
                          font_size: 50
                          pos_hint: {"left":1, "top":0.15}
                  
                      Button:
                          on_release: app.root.current = 'public_transport'
                          text: 'Public Transport'
                          size_hint: 0.5,0.15
                          font_size: 50
                          pos_hint: {"left":1, "top":0.3}
                  
                      Button:
                          on_release: app.root.current = 'traffic'
                          text: 'Traffic'
                          size_hint: 0.5,0.15
                          font_size: 50
                          pos_hint: {"left":1, "top":0.45}
                  
                      DateTime:
                          id: kv_datetime
                          center: self.parent.center
                  
                  <NewsScreen>:
                      name: 'news'
                  
                      Button:
                          on_release: app.root.current = 'home'
                          text: 'back to the home screen'
                          font_size: 50
                  
                  <PublicTransportScreen>:
                      name: 'public_transport'
                  
                      Button:
                          on_release: app.root.current = 'home'
                          text: 'back to the home screen'
                          font_size: 50
                  
                  <TrafficScreen>:
                      name: 'traffic'
                  
                      Button:
                          on_release: app.root.current = 'home'
                          text: 'back to the home screen'
                          font_size: 50
                  
                  <DateTime>:
                      Label:
                          id: kv_timelabel
                          text:
                          font_size: 70  
                          center_x: self.parent.center_x
                          center_y: self.parent.center_y
                  

                  我在運行 main.py 時遇到的錯誤是(我認為這個錯誤的最后兩行左右就足夠了,但你永遠不夠徹底):

                  The error I get when running main.py is (I think the last two lines or so of this error are enough, but you can never be thorough enough):

                  [INFO   ] [Logger      ] Record log in /home/matthias/.kivy/logs/kivy_16-04-17_97.txt
                  [INFO   ] [Kivy        ] v1.9.0
                  [INFO   ] [Python      ] v2.7.10 (default, Oct 14 2015, 16:09:02) 
                  [GCC 5.2.1 20151010]
                  [INFO   ] [Factory     ] 173 symbols loaded
                  [INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
                  [INFO   ] [Text        ] Provider: sdl2
                  [INFO   ] [OSC         ] using <multiprocessing> for socket
                  [INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
                  [INFO   ] [GL          ] OpenGL version <3.0 Mesa 11.0.2>
                  [INFO   ] [GL          ] OpenGL vendor <Intel Open Source Technology Center>
                  [INFO   ] [GL          ] OpenGL renderer <Mesa DRI Intel(R) Ivybridge Mobile >
                  [INFO   ] [GL          ] OpenGL parsed version: 3, 0
                  [INFO   ] [GL          ] Shading version <1.30>
                  [INFO   ] [GL          ] Texture max size <8192>
                  [INFO   ] [GL          ] Texture max units <16>
                  [INFO   ] [Window      ] auto add sdl2 input provider
                  [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
                  [INFO   ] [ProbeSysfs  ] device match: /dev/input/event5
                  [INFO   ] [MTD         ] Read event from </dev/input/event5>
                  [INFO   ] [Base        ] Start application main loop
                  [INFO   ] [GL          ] NPOT texture support is available
                  19:39:33
                  [INFO   ] [Base        ] Leaving application in progress...
                   Traceback (most recent call last):
                     File "main.py", line 49, in <module>
                       MirrorApp().run()
                     File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 824, in run
                   Exception in thread Thread-1:
                       runTouchApp()
                   Traceback (most recent call last):
                     File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 487, in runTouchApp
                       EventLoop.window.mainloop()
                     File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
                     File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 525, in mainloop
                       self.run()
                       self._mainloop()
                     File "/usr/lib/python2.7/threading.py", line 763, in run
                     File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 290, in _mainloop
                       self.__target(*self.__args, **self.__kwargs)
                       EventLoop.idle()
                     File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 327, in idle
                     File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mtdev.py", line 197, in _thread_run
                       Clock.tick()
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 483, in tick
                       self._process_events()
                       _device = Device(_fn)
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 615, in _process_events
                     File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
                       self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
                   OSError: [Errno 13] Permission denied: '/dev/input/event5'
                  
                       event.tick(self._last_tick, remove)
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 374, in tick
                       ret = callback(self._dt)
                     File "main.py", line 19, in update
                       self.ids["kv_timelabel"].text = str(self.curtime)
                   KeyError: 'kv_timelabel'
                  

                  當我將 self.ids["kv_timelabel"].text = str(self.curtime) 替換為 self.ids.kv_timelabel.text = str(self.curtime)代碼> 我明白了:

                  When I replace self.ids["kv_timelabel"].text = str(self.curtime) with self.ids.kv_timelabel.text = str(self.curtime) I get:

                  [INFO   ] [Logger      ] Record log in 
                  /home/matthias/.kivy/logs/kivy_16-04-17_98.txt
                  [INFO   ] [Kivy        ] v1.9.0
                  [INFO   ] [Python      ] v2.7.10 (default, Oct 14 2015, 16:09:02) 
                  [GCC 5.2.1 20151010]
                  [INFO   ] [Factory     ] 173 symbols loaded
                  [INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
                  [INFO   ] [Text        ] Provider: sdl2
                  [INFO   ] [OSC         ] using <multiprocessing> for socket
                  [INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
                  [INFO   ] [GL          ] OpenGL version <3.0 Mesa 11.0.2>
                  [INFO   ] [GL          ] OpenGL vendor <Intel Open Source Technology Center>
                  [INFO   ] [GL          ] OpenGL renderer <Mesa DRI Intel(R) Ivybridge Mobile >
                  [INFO   ] [GL          ] OpenGL parsed version: 3, 0
                  [INFO   ] [GL          ] Shading version <1.30>
                  [INFO   ] [GL          ] Texture max size <8192>
                  [INFO   ] [GL          ] Texture max units <16>
                  [INFO   ] [Window      ] auto add sdl2 input provider
                  [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
                  [INFO   ] [ProbeSysfs  ] device match: /dev/input/event5
                  [INFO   ] [MTD         ] Read event from </dev/input/event5>
                  [INFO   ] [Base        ] Start application main loop
                  [INFO   ] [GL          ] NPOT texture support is available
                  19:42:01
                  [INFO   ] [Base        ] Leaving application in progress...
                   Traceback (most recent call last):
                     File "main.py", line 49, in <module>
                   Exception in thread Thread-1:
                   Traceback (most recent call last):
                     File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
                       self.run()
                     File "/usr/lib/python2.7/threading.py", line 763, in run
                       MirrorApp().run()
                       self.__target(*self.__args, **self.__kwargs)
                     File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 824, in run
                     File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mtdev.py", line 197, in _thread_run
                       runTouchApp()
                       _device = Device(_fn)
                     File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 487, in runTouchApp
                     File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
                       EventLoop.window.mainloop()
                       self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
                     File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 525, in mainloop
                   OSError: [Errno 13] Permission denied: '/dev/input/event5'
                       self._mainloop()
                  
                     File "/usr/lib/python2.7/dist-packages/kivy/core/window/window_sdl2.py", line 290, in _mainloop
                       EventLoop.idle()
                     File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 327, in idle
                       Clock.tick()
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 483, in tick
                       self._process_events()
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 615, in _process_events
                       event.tick(self._last_tick, remove)
                     File "/usr/lib/python2.7/dist-packages/kivy/clock.py", line 374, in tick
                       ret = callback(self._dt)
                     File "main.py", line 19, in update
                       self.ids.kv_timelabel.text = str(self.curtime)
                     File "kivy/properties.pyx", line 720, in kivy.properties.ObservableDict.__getattr__ (kivy/properties.c:10938)
                   AttributeError: 'super' object has no attribute '__getattr__'
                  

                  請注意,當我刪除錯誤中提到的行時,代碼可以正常工作.

                  Note that the code works just fine when I delete the line it mentions in the error.

                  推薦答案

                  將kv文件的加載移到widget之前.所以調用 Builder.loadfile("mirror.kv") 然后聲明你的類 DateTimeHomeScreen (因為它使用 DateTime).您得到的關鍵錯誤可能是因為此小部件還沒有具有該 id 的孩子.

                  Move the loading of the kv file before the widgets. So call the Builder.loadfile("mirror.kv") and then declare your classes DateTime and HomeScreen (since it uses DateTime). The key error you get is probably because this widget doesn't have a child with that id yet.

                  這篇關于python kivy AttributeError:'super'對象沒有屬性'__getattr__'的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)
                  <tfoot id='yYdza'></tfoot>
                  • <i id='yYdza'><tr id='yYdza'><dt id='yYdza'><q id='yYdza'><span id='yYdza'><b id='yYdza'><form id='yYdza'><ins id='yYdza'></ins><ul id='yYdza'></ul><sub id='yYdza'></sub></form><legend id='yYdza'></legend><bdo id='yYdza'><pre id='yYdza'><center id='yYdza'></center></pre></bdo></b><th id='yYdza'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yYdza'><tfoot id='yYdza'></tfoot><dl id='yYdza'><fieldset id='yYdza'></fieldset></dl></div>

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

                        <legend id='yYdza'><style id='yYdza'><dir id='yYdza'><q id='yYdza'></q></dir></style></legend>

                          <tbody id='yYdza'></tbody>
                          • <bdo id='yYdza'></bdo><ul id='yYdza'></ul>

                            主站蜘蛛池模板: 91在线精品视频 | 国产精品毛片一区二区三区 | xnxx 日本免费| 亚洲成人毛片 | 成人一级黄色毛片 | 操人网| 日韩一级免费观看 | 男人天堂社区 | 欧美一区二区三区四区五区无卡码 | 免费v片在线观看 | 久久精品中文字幕 | 欧美久久精品一级黑人c片 91免费在线视频 | 曰韩一二三区 | 日韩成人免费视频 | 国产一区三区在线 | av日韩一区 | 日本又色又爽又黄又高潮 | 国产精品久久久久久吹潮 | av黄色在线 | 亚洲精品免费视频 | 啪啪免费网| 自拍偷拍中文字幕 | 国产视频1区2区 | 一片毛片 | 日韩久久网 | 国产一区二区在线视频 | 国产探花在线精品一区二区 | 欧美精品一区二区三区四区 | 欧美精品日韩精品 | 亚洲欧洲在线视频 | 免费一级黄色电影 | 综合久久99 | 欧美日韩国产精品一区 | 中文字幕一区二区三区不卡 | 91亚洲精品国偷拍自产在线观看 | 国产精品久久久乱弄 | 特黄色一级毛片 | 在线观看中文字幕 | 一区二区三区欧美在线 | 成人乱人乱一区二区三区软件 | 色久电影 |