find.py 文件源码

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

项目:porcupine 作者: Akuli 项目源码 文件源码
def __init__(self, parent, textwidget, **kwargs):
        super().__init__(parent, **kwargs)

        self._last_pattern = None
        self._matches = None

        self.grid_columnconfigure(1, weight=1)
        self._textwidget = textwidget

        entrygrid = ttk.Frame(self)
        entrygrid.grid(row=0, column=0)
        self._find_entry = self._add_entry(entrygrid, 0, "Find:", self.find)
        self._replace_entry = self._add_entry(entrygrid, 1, "Replace with:")

        buttonframe = ttk.Frame(self)
        buttonframe.grid(row=1, column=0, sticky='we')
        buttons = [
            ("Find", self.find),
            ("Replace", self.replace),
            ("Replace and find", self.replace_and_find),
            ("Replace all", self.replace_all),
        ]
        for text, command in buttons:
            button = ttk.Button(buttonframe, text=text, command=command)
            button.pack(side='left', fill='x', expand=True)

        self._full_words_var = tkinter.BooleanVar()
        checkbox = ttk.Checkbutton(self, text="Full words only",
                                   variable=self._full_words_var)
        checkbox.grid(row=0, column=1, sticky='nw')

        self._statuslabel = ttk.Label(self)
        self._statuslabel.grid(row=1, column=1, columnspan=2, sticky='nswe')

        closebutton = ttk.Label(self, image='img_closebutton')
        closebutton.grid(row=0, column=2, sticky='ne')
        closebutton.bind('<Button-1>', lambda event: self.pack_forget())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号