• @AddledBadger , the beta version of Pythonista ships with module called arrow. Really simplifies date and time manipulation. If you are not on the beta version but have installed StaSH, you could pip install arrow yourself. Knowing that when the beta makes it to the App Store, arrow will be included.
    arrow docs
    StaSH

    Look this is not as easy as what the other guys suggest if you dont have arrow installed. I understand why they dont suggest it. Anyway, its another way.

    Anyway, the below is using arrow module.

    import ui import arrow dp = ui.DatePicker(bg_color='white') dp.mode = ui.DATE_PICKER_MODE_DATE_AND_TIME arr_date = arrow.get('2017-11-26 08:00:00', 'YYYY-MM-DD HH:mm:ss') dp.date = arr_date.datetime dp.present('sheet')
  • Hi, moved the script to the root and its been fine since, thanks for the suggestion. Thank, Terry

  • @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!