def create_widgets(self): self.findLabel = TkUtil.Label(self, text="Find:", underline=1) self.findEntry = ttk.Entry(self, width=25) self.replaceLabel = TkUtil.Label(self, text="Replace:", underline=1) self.replaceEntry = ttk.Entry(self, width=25) self.caseSensitiveCheckbutton = TkUtil.Checkbutton(self, text="Case Sensitive", underline=5, variable=self.caseSensitive) self.wholeWordsCheckbutton = TkUtil.Checkbutton(self, text="Whole Words", underline=0, variable=self.wholeWords) self.findButton = TkUtil.Button(self, text="Find", underline=0, command=self.find, default=tk.ACTIVE, state=tk.DISABLED) self.replaceButton = TkUtil.Button(self, text="Replace", underline=0, command=self.replace, state=tk.DISABLED) self.closeButton = TkUtil.Button(self, text="Close", underline=0, command=self.close) if TkUtil.x11(): self.extendButton = TkUtil.ToggleButton(self, text="Extend", underline=1, command=self.toggle_extend) else: self.extendButton = ttk.Button(self, text="Extend", underline=1, command=self.toggle_extend, image=self.images[UNEXTEND], compound=tk.LEFT) self.extensionWidgets = (self.replaceLabel, self.replaceEntry, self.replaceButton)
def unextend(self): self.extendButton.state((TkUtil.NOT_SELECTED,)) self.extendButton.config(text="Extend", underline=1 if not TkUtil.mac() else -1) if not TkUtil.x11(): self.extendButton.config(image=self.images[EXTEND]) self.title("Find \u2014 {}".format(APPNAME)) for widget in self.extensionWidgets: widget.grid_remove()
def extend(self): self.extendButton.state((TkUtil.SELECTED,)) self.extendButton.config(text="Unextend", underline=3 if not TkUtil.mac() else -1) if not TkUtil.x11(): self.extendButton.config(image=self.images[UNEXTEND]) self.title("Find and Replace \u2014 {}".format(APPNAME)) for widget in self.extensionWidgets: widget.grid()
def unextend(self): self.extendButton.state((TkUtil.NOT_SELECTED, )) self.extendButton.config(text="Extend", underline=1 if not TkUtil.mac() else -1) if not TkUtil.x11(): self.extendButton.config(image=self.images[EXTEND]) self.title("Find \u2014 {}".format(APPNAME)) for widget in self.extensionWidgets: widget.grid_remove()
def extend(self): self.extendButton.state((TkUtil.SELECTED, )) self.extendButton.config(text="Unextend", underline=3 if not TkUtil.mac() else -1) if not TkUtil.x11(): self.extendButton.config(image=self.images[UNEXTEND]) self.title("Find and Replace \u2014 {}".format(APPNAME)) for widget in self.extensionWidgets: widget.grid()
def create_variables(self): self.caseSensitive = tk.IntVar() self.caseSensitive.set(0) self.wholeWords = tk.IntVar() self.wholeWords.set(0) self.extensionWidgets = () if not TkUtil.x11(): self.images = {} imagePath = os.path.join(os.path.dirname( os.path.realpath(__file__)), "images") for name in (EXTEND, UNEXTEND): filename = os.path.join(imagePath, name + "_16x16.gif") if os.path.exists(filename): self.images[name] = tk.PhotoImage(file=filename)
def create_variables(self): self.caseSensitive = tk.IntVar() self.caseSensitive.set(0) self.wholeWords = tk.IntVar() self.wholeWords.set(0) self.extensionWidgets = () if not TkUtil.x11(): self.images = {} imagePath = os.path.join( os.path.dirname(os.path.realpath(__file__)), "images") for name in (EXTEND, UNEXTEND): filename = os.path.join(imagePath, name + "_16x16.gif") if os.path.exists(filename): self.images[name] = tk.PhotoImage(file=filename)
def create_widgets(self): self.findLabel = TkUtil.Label(self, text="Find:", underline=1) self.findEntry = ttk.Entry(self, width=25) self.replaceLabel = TkUtil.Label(self, text="Replace:", underline=1) self.replaceEntry = ttk.Entry(self, width=25) self.caseSensitiveCheckbutton = TkUtil.Checkbutton( self, text="Case Sensitive", underline=5, variable=self.caseSensitive) self.wholeWordsCheckbutton = TkUtil.Checkbutton( self, text="Whole Words", underline=0, variable=self.wholeWords) self.findButton = TkUtil.Button(self, text="Find", underline=0, command=self.find, default=tk.ACTIVE, state=tk.DISABLED) self.replaceButton = TkUtil.Button(self, text="Replace", underline=0, command=self.replace, state=tk.DISABLED) self.closeButton = TkUtil.Button(self, text="Close", underline=0, command=self.close) if TkUtil.x11(): self.extendButton = TkUtil.ToggleButton(self, text="Extend", underline=1, command=self.toggle_extend) else: self.extendButton = ttk.Button(self, text="Extend", underline=1, command=self.toggle_extend, image=self.images[UNEXTEND], compound=tk.LEFT) self.extensionWidgets = (self.replaceLabel, self.replaceEntry, self.replaceButton)