为了账号安全,请及时绑定邮箱和手机立即绑定

当我尝试访问屏幕 ID 时,“super”对象没有属性“__getattr__”

当我尝试访问屏幕 ID 时,“super”对象没有属性“__getattr__”

斯蒂芬大帝 2023-08-15 16:34:01
这两天我一直在尝试解决这个问题。我几乎尝试了一切。我检查了我的 ID 10 次,无论它们是否是字符串。他们不是!!我放置了clock.schedule_one方法来延迟初始化,但程序没有在kv文件中定义id。这是代码;这是错误消息;KeyError: 'hasta'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users\Melikşah GÜRCÜ\Desktop\md.py", line 162, in <module>    DemoApp().run()  File "C:\python\lib\site-packages\kivy\app.py", line 855, in run    runTouchApp()  File "C:\python\lib\site-packages\kivy\base.py", line 504, in runTouchApp    EventLoop.window.mainloop()  File "C:\python\lib\site-packages\kivy\core\window\window_sdl2.py", line 747, in mainloop    self._mainloop()  File "C:\python\lib\site-packages\kivy\core\window\window_sdl2.py", line 479, in _mainloop    EventLoop.idle()  File "C:\python\lib\site-packages\kivy\base.py", line 339, in idle    Clock.tick()  File "C:\python\lib\site-packages\kivy\clock.py", line 591, in tick    self._process_events()  File "kivy\_clock.pyx", line 384, in kivy._clock.CyClockBase._process_events  File "kivy\_clock.pyx", line 414, in kivy._clock.CyClockBase._process_events  File "kivy\_clock.pyx", line 412, in kivy._clock.CyClockBase._process_events  File "kivy\_clock.pyx", line 167, in kivy._clock.ClockEvent.tick  File "C:\Users\Melikşah GÜRCÜ\Desktop\md.py", line 155, in _press    self.root.ids.hasta.text  File "kivy\properties.pyx", line 863, in kivy.properties.ObservableDict.__getattr__AttributeError: 'super' object has no attribute '__getattr__'
查看完整描述

1 回答

?
慕容3067478

TA贡献1773条经验 获得超3个赞

class DemoApp(MDApp):


    def _press(self, *dt):

        print(self.root.get_screen("scr2").ids.hasta.text)


    def _doThis(self, *dt):

        print(self.root.get_screen("scr2").ids.hasta.text)


查看完整回答
反对 回复 2023-08-15
  • 1 回答
  • 0 关注
  • 105 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信