recipe-580734.py 文件源码

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

项目:code 作者: ActiveState 项目源码 文件源码
def __init__(self, master, **kwargs):
        Frame.__init__(self, master)

        textarea_frame = Frame(self, bd=1, relief=SOLID,**kwargs)
        textarea_frame.pack(fill=X)
        textarea_frame.pack_propagate(False)

        self.textarea = Text(textarea_frame, height=1, pady=self.TAG_ENTRY_PADY, padx=self.TAG_ENTRY_PADX, highlightthickness =0, spacing1=0, spacing2=0, spacing3=0, borderwidth=0, wrap="none")
        self.textarea.pack(expand=True, fill=BOTH, padx=2)

        scrollbar = Scrollbar(self, orient=HORIZONTAL, command=self.textarea.xview)
        scrollbar.pack(fill=X)

        self.textarea.configure(xscrollcommand=scrollbar.set)
        self.textarea.bind("<KeyPress>",self._on_keypress)

        tag = Tag(self.textarea, "")
        self.textarea.window_create("1.0", window=tag)
        self.update_idletasks()

        tag_reqheight = tag.winfo_reqheight()
        textarea_frame.configure(height=tag_reqheight + 2*self.TAG_ENTRY_PADY+2*self.textarea["borderwidth"])

        # I add a hidden frame because I want the cursor centered including when there is no tag
        self.textarea.window_create("1.0", window=Frame(self.textarea, height=tag_reqheight, width=0, borderwidth=0))
        tag.destroy()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号