![]() |
Due to MDLable ID does not have get attribute how to override on this - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Due to MDLable ID does not have get attribute how to override on this (/thread-35826.html) |
Due to MDLable ID does not have get attribute how to override on this - jayyu - Dec-20-2021 As i am new learner on kivy language with python here is my code from kivy import app from kivy.lang import Builder from kivymd.app import MDApp from kivymd.uix.screen import MDScreen from kivy.uix.relativelayout import RelativeLayout from kivy.uix.screenmanager import ScreenManager from kivy.properties import ObjectProperty from datetime import timedelta from datetime import datetime from kivy.clock import Clock Builder.load_string(''' <TOolBar_Window>: #timeday: timeday name:'Main_Window1' RelativeLayout: MDToolbar: title: 'Main_Window1' elevation: 10 right_action_items: [['logout']] pos_hint: {"left":1, "top":1} MDLabel: id: timeday #text: "name" markup:True halign:'center' multiline:True ''') class TOolBar_Window(MDScreen): pass class MainApp(MDApp): #timeday = ObjectProperty(None) def build(self): self.sm= ScreenManager() self.sm.add_widget(TOolBar_Window(name ='tolBar_Window1')) return self.sm def on_start(self): Clock.schedule_interval(self.dell,1) def dell(self,nap): self.nap=datetime.now() self.nap = self.nap + timedelta(seconds = 1) self.day = self.nap.strftime('%A') self.date = self.nap.strftime('%d/%m/%Y') self.time = self.nap.strftime('%I:%M:%S') self.root.ids.timeday.text = self.day+'\n'+self.date+'\n'+self.time if __name__ == '__main__': MainApp().run()In my code i get a error like this If i remove this lineself.root.ids.timeday.text =self.day+'\n'+self.date+'\n'+self.timethen code is running and but time and date not updated i also trying with object property but still not get same error i also try parents widgets but not use with this error 'super' is substituted with the real value, because well... it doesn't have getattr,To keep my answer brief, here's the minimalistic object that extends Scatter object.,super gives you an access to a class you inherit from,I suspect(not sure) that if you use string as the value for id, you'll end up with weakref / WeakProxy pointing to a string. please help thank you |