Python tkinter.ACTIVE Examples
The following are 13
code examples of tkinter.ACTIVE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.
Example #1
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def onTokenRightClick(self, event): item = self._get_id(event) popup = tk.Menu(self, tearoff=0) popup.add_command(label='Grow', command=lambda: self.grow_node(item), accelerator='G') popup.add_command(label='Grow until...', command=lambda: self.grow_until(item)) popup.add_command(label='Mark', command=lambda: self.mark_node(item), accelerator='M') popup.add_command(label='Hide', command=lambda: self.hide_node(item), accelerator='H') hide_behind = tk.Menu(popup, tearoff=0) for _, n in self.dispG.edges_iter(item): assert _ == item if self._radial_behind(item, n): state = tk.ACTIVE else: state = tk.DISABLED hide_behind.add_command(label=str(self.dispG.node[n]['dataG_id']), state=state, command=lambda item=item, n=n: self.hide_behind(item, n)) popup.add_cascade(label='Hide Behind', menu=hide_behind) token = self.dispG.node[item]['token'] token.customize_menu(popup, item) try: popup.post(event.x_root, event.y_root) finally: popup.grab_release()
Example #2
Source File: components.py From SEM with MIT License | 5 votes |
def workflow(self): wf = self.masters.get(tkinter.ACTIVE) return os.path.join(self.resource_dir, "master", self.lang(), wf) or None
Example #3
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
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)
Example #4
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
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")
Example #5
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
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)
Example #6
Source File: Dialog.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
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
Example #7
Source File: widgets.py From vy with MIT License | 5 votes |
def on_tab(self): index = self.listbox.index(ACTIVE) findline(*self.options[index][1]) self.close()
Example #8
Source File: widgets.py From vy with MIT License | 5 votes |
def on_current(self): index = self.listbox.index(ACTIVE) filename = self.options[index][1][0] line = self.options[index][1][1] # If the file is already loaded then just set the line. if not AreaVi.INPUT.filename in filename: AreaVi.INPUT.load_data(filename) AreaVi.INPUT.setcur(line, 0) self.close()
Example #9
Source File: ysnippet.py From vy with MIT License | 5 votes |
def drop_on_tab(self, event): area = root.note.create('none') index = self.listbox.index(ACTIVE) snippet = self.options[index][1][1] area.insert('insert', snippet) area.see('insert') # Select the tab. root.note.select(area.master.master.master) root.status.set_msg('Snippet: %s!' % self.options[index][0]) self.close()
Example #10
Source File: ysnippet.py From vy with MIT License | 5 votes |
def drop_on_cur(self, event): index = self.listbox.index(ACTIVE) snippet = self.options[index][1][1] AreaVi.INPUT.insert('insert', snippet) AreaVi.INPUT.see('insert') root.status.set_msg('Snippet: %s!' % self.options[index][0]) self.close()
Example #11
Source File: ysnippet.py From vy with MIT License | 5 votes |
def delete(self, event): index = self.listbox.index(ACTIVE) values = (self.options[index][1][0],) self.cur.execute('''DELETE FROM snippet where id=?''', values) self.conn.commit() root.status.set_msg('Snippet deleted!') self.listbox.delete(index) # Otherwise it gets messed up. del self.options[index]
Example #12
Source File: chapter4_07_disabled.py From Tkinter-GUI-Application-Development-Cookbook with MIT License | 5 votes |
def enable_selection(self): state_selection = tk.ACTIVE if self.text.tag_ranges(tk.SEL) else tk.DISABLED state_clipboard = tk.ACTIVE try: self.clipboard_get() except tk.TclError: state_clipboard = tk.DISABLED self.menu.entryconfig(0, state=state_selection) # Cut self.menu.entryconfig(1, state=state_selection) # Copy self.menu.entryconfig(2, state=state_clipboard) # Paste self.menu.entryconfig(3, state=state_selection) # Delete
Example #13
Source File: exchange_sample_dialog.py From Oe2sSLE with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, smp, exchg_with, *args, **kwargs): super().__init__(parent, *args, **kwargs) self.transient(parent) self.title('Exchange sample') self.parent = parent self.result = None self.exchg_with = exchg_with self.mix_var = tk.DoubleVar() body = tk.Frame(self) tk.Label(body, text="Exchange #{}: '{}' with: ".format(smp[0], smp[1])).pack(fill=tk.X) self.entryWith = ROCombobox(body, values=["#{}: '{}'".format(smp[0], smp[1]) for smp in exchg_with], width=24) self.entryWith.set("#{}: '{}'".format(smp[0], smp[1])) self.entryWith.pack() body.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) box = tk.Frame(self) w = tk.Button(box, text="OK", width=10, command=self.ok, default=tk.ACTIVE) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(box, text="Cancel", width=10, command=self.cancel) w.pack(side=tk.LEFT, padx=5, pady=5) self.bind("<Return>", self.ok) self.bind("<Escape>", self.cancel) self.bind("<space>", lambda event: self.play()) box.pack() # self.protocol("WM_DELETE_WINDOW", self.close) # temporarily hide the window self.withdraw() self.update() width, height = (self.winfo_width(), self.winfo_height()) self.minsize(width, height) px, py = (parent.winfo_rootx(), parent.winfo_rooty()) pwidth, pheight = (parent.winfo_width(), parent.winfo_height()) x, y = (px+pwidth/2-width/2, py+pheight/2-height/2) self.geometry("+{}+{}".format(int(x), int(y))) self.deiconify() self.focus_set() self.grab_set() # # standard button semantics