本文整理汇总了Python中tkinter.ACTIVE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.ACTIVE属性的具体用法?Python tkinter.ACTIVE怎么用?Python tkinter.ACTIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.ACTIVE属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onTokenRightClick
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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()
示例2: workflow
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
def workflow(self):
wf = self.masters.get(tkinter.ACTIVE)
return os.path.join(self.resource_dir, "master", self.lang(), wf) or None
示例3: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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)
示例4: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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")
示例5: add_button
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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
示例6: on_tab
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
def on_tab(self):
index = self.listbox.index(ACTIVE)
findline(*self.options[index][1])
self.close()
示例7: on_current
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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()
示例8: drop_on_tab
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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()
示例9: drop_on_cur
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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()
示例10: delete
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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]
示例11: enable_selection
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:15,代码来源:chapter4_07_disabled.py
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ACTIVE [as 别名]
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