window.py 文件源码

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

项目:quill 作者: DeflatedPickle 项目源码 文件源码
def insert_checkbutton(self, what: str="", variable: tk.BooleanVar=None, fill_line: bool=True, index: int or str="end", command=None, *args):
        """Insert a checkbutton into the game."""
        tag = "Check-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", what), self.id_current_check)
        if variable.get():
            self.text.tag_configure(tag, foreground=self.colour_check_on)
        elif not variable.get():
            self.text.tag_configure(tag, foreground=self.colour_check_off)
        self.text.insert(index, what + "\n" if fill_line else what, tag)

        self.unbind_tag(tag)

        self.text.tag_bind(tag, "<Button-1>", command, "+")
        self.text.tag_bind(tag, "<Button-1>", lambda *args: self.toggle_check(variable, tag), "+")

        self.bind_cursor(tag)
        self.bind_background(tag)

        self.id_current_check += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号