本文整理汇总了Python中TkUtil.windows方法的典型用法代码示例。如果您正苦于以下问题:Python TkUtil.windows方法的具体用法?Python TkUtil.windows怎么用?Python TkUtil.windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TkUtil
的用法示例。
在下文中一共展示了TkUtil.windows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_edit_menu
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import windows [as 别名]
def create_edit_menu(self):
modifier = TkUtil.menu_modifier()
self.editMenu = tk.Menu(self.menubar)
self.editMenu.add_command(label=UNDO, underline=0,
command=self.editor.edit_undo,
image=self.menuImages[UNDO], compound=tk.LEFT,
accelerator=modifier + "+Z")
redo = "+Shift+Z"
if TkUtil.windows():
redo = "+Y"
self.editMenu.add_command(label=REDO, underline=0,
command=self.editor.edit_redo,
image=self.menuImages[REDO], compound=tk.LEFT,
accelerator=modifier + redo)
self.editMenu.add_separator()
self.editMenu.add_command(label=COPY, underline=0,
command=lambda: self.editor.text.event_generate(
"<<Copy>>"), image=self.menuImages[COPY],
compound=tk.LEFT, accelerator=modifier + "+C")
self.editMenu.add_command(label=CUT, underline=2,
command=lambda: self.editor.text.event_generate("<<Cut>>"),
image=self.menuImages[CUT], compound=tk.LEFT,
accelerator=modifier + "+X")
self.editMenu.add_command(label=PASTE, underline=0,
command=lambda: self.editor.text.event_generate(
"<<Paste>>"), image=self.menuImages[PASTE],
compound=tk.LEFT, accelerator=modifier + "+V")
self.editMenu.add_separator()
self.editMenu.add_command(label=FIND + ELLIPSIS, underline=0,
command=self.find, image=self.menuImages[FIND],
compound=tk.LEFT, accelerator=modifier + "+F")
self.menubar.add_cascade(label="Edit", underline=0,
menu=self.editMenu)
示例2: set_drag_cursor
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import windows [as 别名]
def set_drag_cursor(self, on=True):
if on:
cursor = "sizing" # Mac OS X can only use built-in Tk cursors
path = os.path.realpath(os.path.join(os.path.dirname(__file__), "images"))
if TkUtil.windows():
cwd = None
try:
cwd = os.getcwd()
os.chdir(path) # Paths don't work on Windows 7
self.master.config(cursor="@drag.cur")
finally:
if cwd is not None:
os.chdir(cwd)
elif not TkUtil.mac():
# Mask made by http://www.kirsle.net/wizards/xbmask.cgi
cursor = ("@" + os.path.join(path, "drag.xbm"), os.path.join(path, "drag_mask.xbm"), "#DF00FF", "white")
self.master.config(cursor=cursor)
else:
self.master.config(cursor="")
self.master.update()
示例3: undock
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import windows [as 别名]
def undock(self, dock, x=None, y=None):
"""Warning: On Mac OS X 10.5 undocking works imperfectly.
Left and right docking work fine though.
"""
dock.pack_forget()
dock.config(relief=tk.FLAT, borderwidth=0)
dock.tk.call("wm", "manage", dock)
on_close = dock.register(dock.on_close)
dock.tk.call("wm", "protocol", dock, "WM_DELETE_WINDOW", on_close)
title = dock.title if hasattr(dock, "title") else "Dock"
dock.tk.call("wm", "title", dock, title)
minsize = dock.minsize if hasattr(dock, "minsize") else (60, 30)
dock.tk.call("wm", "minsize", dock, *minsize)
dock.tk.call("wm", "resizable", dock, False, False)
if TkUtil.windows():
dock.tk.call("wm", "attributes", dock, "-toolwindow", True)
if x is not None and y is not None:
self.xy_for_dock[dock] = (x, y)
x, y = self.xy_for_dock.get(dock, (None, None))
if x is not None and y is not None:
dock.tk.call("wm", "geometry", dock, "{:+}{:+}".format(x, y))
self.__remove_area(dock)