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 create_ui(self): self.helpLabel = ttk.Label(self, text=_TEXT, background="white") self.closeButton = TkUtil.Button(self, text="Close", underline=0) self.helpLabel.pack(anchor=tk.N, expand=True, fill=tk.BOTH, padx=PAD, pady=PAD) self.closeButton.pack(anchor=tk.S) self.protocol("WM_DELETE_WINDOW", self.close) if not TkUtil.mac(): self.bind("<Alt-c>", self.close) self.bind("<Escape>", self.close) self.bind("<Expose>", self.reposition)
def add_button(self, master, text, underline, command, default=False, shortcut=None): button = TkUtil.Button(master, text=text, underline=underline, command=command) if default: button.config(default=tk.ACTIVE) button.pack(side=tk.LEFT, padx=PAD, pady=PAD) if shortcut is not None and int(button.cget("underline")) != -1: self.bind(shortcut, command) return button
def create_widgets(self): self.sourceLabel = ttk.Label(self, text="Source Folder:", underline=-1 if TkUtil.mac() else 1) self.sourceEntry = ttk.Entry(self, width=30, textvariable=self.sourceText) self.sourceButton = TkUtil.Button( self, text="Source...", underline=0, command=lambda *args: self.choose_folder(SOURCE)) self.helpButton = TkUtil.Button(self, text="Help", underline=0, command=self.help) self.targetLabel = ttk.Label(self, text="Target Folder:", underline=-1 if TkUtil.mac() else 1) self.targetEntry = ttk.Entry(self, width=30, textvariable=self.targetText) self.targetButton = TkUtil.Button( self, text="Target...", underline=0, command=lambda *args: self.choose_folder(TARGET)) self.aboutButton = TkUtil.Button(self, text="About", underline=1, command=self.about) self.statusLabel = ttk.Label(self, textvariable=self.statusText) self.scaleButton = TkUtil.Button(self, text="Scale", underline=1, command=self.scale_or_cancel, default=tk.ACTIVE, state=tk.DISABLED) self.quitButton = TkUtil.Button(self, text="Quit", underline=0, command=self.close) self.dimensionLabel = ttk.Label(self, text="Max. Dimension:", underline=-1 if TkUtil.mac() else 6) self.dimensionCombobox = ttk.Combobox( self, textvariable=self.dimensionText, state="readonly", values=("50", "100", "150", "200", "250", "300", "350", "400", "450", "500")) TkUtil.set_combobox_item(self.dimensionCombobox, "400")