def __init__(self,frame=(0,0,300,32),name='dropdown', items=[]):
'''Create a dropdown view, with items in list.
items can be either an iterable, or a function returning an iterable.
the function can be interrupted if it checks .abort(), which is set when user selects a row, for expensive ops like os.walk.
pressing the dropdown button brings up the list, which can be aborted by selecting an item
'''
self.frame=frame
self.textfield=ui.TextField(frame=frame,name='textfield')
self.textfield.autocapitalization_type=ui.AUTOCAPITALIZE_NONE
self.textfield.autocorrection_type=False
self.button=ui.Button(name='button',bg_color=None)
self.add_subview(self.textfield)
self.add_subview(self.button)
h=frame[3]
self.button.frame=(self.width-32, h-32, 32,32)
self.button.image=ui.Image.named('ionicons-arrow-down-b-32')
self.button.action=self.open_finder
self.base=os.path.expanduser('~/Documents')
self._abort=False
self.items=items
self.button.flex='l'
self.textfield.flex='w'
评论列表
文章目录