Python Forum
Due to MDLable ID does not have get attribute how to override on this
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Due to MDLable ID does not have get attribute how to override on this
#1
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
buran write Dec-20-2021, 11:35 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python update binary object (override delivered Object properties) pierre38 4 1,781 May-19-2022, 07:52 AM
Last Post: pierre38
  dict class override: how access parent values? Andrey 1 1,648 Mar-06-2022, 10:49 PM
Last Post: deanhystad
  Override a library function that is not in __all__ Weird 7 3,296 Aug-23-2021, 05:03 PM
Last Post: Larz60+
  Merge dicts without override chisox721 4 3,259 Jul-20-2019, 01:45 AM
Last Post: chisox721
  Could I override a fully implemented method zatlas1 2 2,418 Jun-06-2019, 02:20 AM
Last Post: zatlas1
  How can we override decorator? bhojendra 2 9,390 May-12-2019, 11:15 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020