• enceladus

    Here is an example implementation and I hope it helps
    https://gist.github.com/4e520ac2104b902b7a2394d4e7855fa3

    posted in Pythonista read more
  • enceladus

    @reticulated have you seen this post?
    https://forum.omz-software.com/topic/2747/python-3-x-progress-update/148

    from @omz: That's very kind of you, but I really wouldn't feel comfortable taking donations. Pythonista is doing quite well, actually – over the last 3 years, I've managed to convince an average of 50 people every day to buy the app, and as a solo developer without a lot of expenses, I think that's pretty good. :) There are a lot of projects that need donations much more than I do.
    from @Olaf : wow, 3 * 365 * 50 > 50,000 Pythonistas, that's quite a global tribe!

    posted in Pythonista read more
  • enceladus

    I was a happy user of computable ( and of course pythonista). Currently it is out of App Store but the author has open sourced it. It supports sci-fi, pandas, Jupyter(ipython) etc.
    https://github.com/ktraunmueller/Computable

    May be the community could start from there.

    posted in Pythonista read more
  • enceladus

    def hasdupelems(l):
        return len(l) != len(set(l))
        
    print(hasdupelems(['ab', 'cd', 'ab', 'ef']))
    print(hasdupelems(['ab', 'cd',  'ef']))
    

    posted in Pythonista read more
  • enceladus

    word = 'python'
    print('*'.join(word))
    

    posted in Pythonista read more
  • enceladus

    You can also use update

    import ui
    
    def table_tapped(sender):
        rowtext = sender.items[sender.selected_row]
        print(rowtext)
    
    class TableUpdate(ui.View):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.reset_value = 2
            self.stop_value = 20
            self.value = self.reset_value
            self.state = 'stop'
            self.update_interval = 1
            self.add_subview(ui.TableView(name='tableview1', frame=(0,0,400,400)))
            self.reset_table_view()
            self.add_subview(ui.Button(title='Reset', frame=(50,450,100,100), action=button_action))
            self.add_subview(ui.Button(title='Start', frame=(160,450,100,100), action=button_action))
            self.add_subview(ui.Button(title='Stop', frame=(270,450,100,100), action=button_action))
    
        def reset_table_view(self):
            self.value = self.reset_value
            self.update_table_view()
            
        def update_table_view(self):   
            self['tableview1'].data_source = ui.ListDataSource(range(self.value))
            self['tableview1'].data_source.action  = table_tapped
            self['tableview1'].delegate = self['tableview1'].data_source
            self['tableview1'].reload_data()            
                                                 
        def update(self):
            if self.state == 'run':
                if self.value < self.stop_value:
                    self['tableview1'].data_source.items.append(self.value)
                    self['tableview1'].reload_data() 
                    self.value += 1           
            self.set_needs_display()
        
    def button_action(sender):
        v1 = sender.superview   
        if sender.title == 'Reset':
            v1.state = 'stop'
            v1.reset_table_view()
        elif sender.title == 'Start':
            v1.state = 'run'
        elif sender.title == 'Stop':
            v1.state = 'stop'
          
    v = TableUpdate(frame=(0,0,400,500), name='view1')
    v.present('sheet') 
    
    

    posted in Pythonista read more
  • enceladus

    You could have footer also in the sections

    import dialogs
    import datetime
    
    form_list_of_sections = []
    
    sectionA_dicts = []
    sectionA_dicts.append(dict(type = 'text', title = 'First Name',
    key = 'first', placeholder = 'John'))
    
    sectionA_dicts.append(dict(type = 'text', title = 'Last Name',
    key = 'last', placeholder = 'Doe')) 
    
    sectionA_dicts.append(dict(type = 'number', title = 'age',
    key = 'age', placeholder='30')) 
    
    form_list_of_sections.append(('Section A', sectionA_dicts, 'Section A ends'))
    
    sectionB_dicts = []
    sectionB_dicts.append(dict(type = 'date', title = 'Date Of Birth',
    key = 'DOB', value = datetime.date.today()))
    
    sectionB_dicts.append(dict(type = 'url', title = 'Home Page',
        key = 'homepage', placeholder = 'http://example.com')) 
        
    form_list_of_sections.append(('Section B', sectionB_dicts, 'Section B ends'))
    
    sectionC_dicts = []
    sectionC_dicts.append(dict(type = 'email', title = 'email',
    key = 'email', placeholder = 'name@mailserver.com')) 
    
    sectionC_dicts.append(dict(type = 'switch', title = 'is_married',
    key = 'is_married', value = True))  
    
    sectionC_dicts.append(dict(type = 'check', title = 'is_registered',
    key = 'is_registered', value = False))  
    
    form_list_of_sections.append(('Section C', sectionC_dicts, 'Section C ends'))
    
    diag = dialogs.form_dialog(title = 'Form Dialog', sections=form_list_of_sections)
    print(diag)
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!