• @ccc I was wondering why you recommend avoiding strftime()

  • @AddledBadger , not to upset the apple cart so to speak. But another way is to add your own custom attrs to the ui.Button once you have created them. In the below, I added an attr to the ui.Button called your 'username'. It's done just by making the assignment. In this case I assigned a string, but I could have assigned anything. A dict, list, int etc... look, I am still a newbie. I think this way is not considered the best way of doing things. But sometimes you do want to associate data with a ui element. For data I want to associate with an item, I normally use the attr name tag rather than dreaming up new names all the time to help keep it clear.

    Anyway it's just another idea.

    import ui class MyClass(ui.View): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.make_view() def make_view(self): A = ui.Button(title='A', action=self.show_view) A.AddledBadger = 'This is my A type personality' # adding a attr to the btn at runtime B = ui.Button(title='B', action=self.show_view) B.x = A.width + 30 B.AddledBadger = 'This is my B type personality' self.add_subview(A) self.add_subview(B) # you will notice your attr is print print(dir(A)) def show_view(self, sender): print(sender.AddledBadger) return # if not all objects passed to this func may not have your new attr # you could do something like the below - if hasattr(sender, 'AddledBadger'): print('it has my custom attr') else: print('sender does not have my custom attr, i better do something else') if __name__ == '__main__': f = (0, 0, 300, 400) v = MyClass(frame = f) v.present(style='sheet', animated=False)
Internal error.

Oops! Looks like something went wrong!