Python Forum
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

Error:
self.root.ids.timeday.text = self.day+'\n'+self.date+'\n'+self.time File "kivy/properties.pyx", line 864, in kivy.properties.ObservableDict.__getattr__ AttributeError: 'super' object has no attribute '__getattr__'
If i remove this line

self.root.ids.timeday.text =self.day+'\n'+self.date+'\n'+self.time 
then 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