layout.py 文件源码

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

项目:BioDataSorter 作者: BioDataSorter 项目源码 文件源码
def button_from_label(self, text, image_url, cmd, status):
        image = Image.open(image_url)
        image = image.resize((30, 30), Image.ANTIALIAS)
        photo = ImageTk.PhotoImage(image)
        btn = Label(self,
                    text=text,
                    image=photo,
                    compound=TOP,
                    width=70,
                    bg=NOTEBOOK_COLOR,
                    cursor='hand2')
        btn.bind('<Button-1>', cmd)
        btn.bind('<Enter>', lambda e: (btn.config(bg='light cyan'),
                                       self.controller.status_bar.set(status)))
        btn.bind('<Leave>', lambda e:
                 (btn.config(bg=NOTEBOOK_COLOR),
                  self.controller.status_bar.set('Ready')))
        btn.bind('<ButtonRelease-1>', lambda e: btn.config(bg='light cyan'))
        return btn, photo
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号