本文整理汇总了Python中Tkinter.ACTIVE属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.ACTIVE属性的具体用法?Python Tkinter.ACTIVE怎么用?Python Tkinter.ACTIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.ACTIVE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clickLoad
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import ACTIVE [as 别名]
def clickLoad(self):
if self.__is_verbose: print "ACTION: Clicked 'Load'"
# turn off toggle buttons
self.spaces_button.setOff()
self.cps_button.setOff()
if not self.loadImage(self.SETUP_IMAGE, self.display,
s.PICTURE_RESOLUTION[0]/2, s.PICTURE_RESOLUTION[1]/2):
tkMessageBox.showerror(title = "Error!",
message = "Error loading setup image."
+ " Please ensure setup image exists as ./image/setup_image.jpeg.")
return
# clear all previous data, and activate buttons
self.clear_button.invoke()
self.cps_button.config(state = tk.ACTIVE)
self.spaces_button.config(state = tk.ACTIVE)
示例2: buttonbox
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import ACTIVE [as 别名]
def buttonbox(self):
try:
self.attributes("-toolwindow",1) #only works on windows
except:
#self.overrideredirect(1) #removes whole frame
self.resizable(0,0) #stops maximising and resizing but can still be minimised
box = tk.Frame(self)
w = tk.Button(box, text="Don't Save", width=10, command=self.close_dont_save)
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)
w = tk.Button(box, text="Save", width=10, command=self.close_and_save, default=tk.ACTIVE)
w.pack(side=tk.LEFT, padx=5, pady=5)
self.bind("<Return>", self.close_and_save)
self.bind("<Escape>", self.cancel)
box.pack()
示例3: buttonbox
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import ACTIVE [as 别名]
def buttonbox(self, box):
# add standard button box. override if you don't want the
# standard buttons
frame = tk.Frame(box)
frame.pack()
w = tk.Button(frame, text="OK", width=10, command=self.ok, default=tk.ACTIVE)
w.pack(side=tk.LEFT, padx=5, pady=5)
w = tk.Button(frame, 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)
#
# standard button semantics
示例4: returnPressHandler
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import ACTIVE [as 别名]
def returnPressHandler(self, event):
"""
Handle Return-key-press events. Capture a new setup image when PiCam
is active, and load the image.
"""
# ensure focus on window
self.focus_set()
# do nothing if camera is not active, or no camera object exists
if not self.__camera_is_active or not self.__camera: return
try:
# capture new setup image, then close the camera
self.__camera.capture(self.SETUP_IMAGE)
self.__camera.stop_preview()
self.__camera.close()
self.__camera_is_active = False
if self.__is_verbose:
print "INFO: New setup image captured."
print "INFO: PiCam deactivated."
except:
# image failed to capture, show error message
tkMessageBox.showerror(title = "Error!",
message = "Error: Failed to capture new setup image.")
# load the new setup image
self.loadImage(self.SETUP_IMAGE, self.display,
s.PICTURE_RESOLUTION[0]/2, s.PICTURE_RESOLUTION[1]/2)
# activate buttons if they're disabled
self.cps_button.config(state = tk.ACTIVE)
self.spaces_button.config(state = tk.ACTIVE)
# --------------------------------------------------------------------------
# Escape-key-press Event Handler
# --------------------------------------------------------------------------
示例5: 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()
示例6: _enter
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import ACTIVE [as 别名]
def _enter(self, event, image):
widget = event.widget
if widget and widget['state'] != tk.DISABLED:
widget.configure(state = tk.ACTIVE)
if image:
image.configure(foreground = self.current['activeforeground'], background = self.current['activebackground'])
示例7: 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