avv
Jan 10, 2015 - 06:33
Give me an example of working with the regime!
Give me an example of working with the regime!
import ui
def make_table_view():
tv = ui.TableView()
tv.allows_multiple_selection_during_editing = tv.editing = True
tv.data_source = tv.delegate = ui.ListDataSource('One Two Three Four Five'.split())
return tv
class MultipleSelectionView(ui.View):
def __init__(self):
self.tv = make_table_view()
self.add_subview(self.tv)
self.present()
self.tv.frame = self.bounds
def get_selections(self):
return [self.tv.data_source.items[row] for (_, row) in self.tv.selected_rows]
view = MultipleSelectionView()
view.wait_modal()
print(view.get_selections())
Thank you for a good example! Congratulations to all a Happy New Year!