dropdown.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:pythonista-scripts 作者: khilnani 项目源码 文件源码
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'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号