本文整理汇总了Python中canvas.Canvas.setEraser方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.setEraser方法的具体用法?Python Canvas.setEraser怎么用?Python Canvas.setEraser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.setEraser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import setEraser [as 别名]
#.........这里部分代码省略.........
window=self.window, batch=self.canvas.batch, group=self.fg_group,
anchor=kytten.ANCHOR_CENTER,
theme=self.cobalt, on_escape=self.on_escape, on_select=on_select)
def create_directory_select_dialog(self):
dialog = None
def on_select(filename):
print("Directory: %s" % filename)
self.on_escape(dialog)
dialog = kytten.DirectorySelectDialog(
window=self.window, batch=self.canvas.batch, group=self.fg_group,
anchor=kytten.ANCHOR_CENTER,
theme=self.cobalt, on_escape=self.on_escape, on_select=on_select)
def on_select(self, choice):
if choice == 'Open File':
self.create_file_load_dialog()
elif choice == 'Save File':
self.create_file_save_dialog()
elif choice == 'Directory Select':
self.create_directory_select_dialog()
else:
print("Unexpected menu selection: %s" % choice)
def mainDialog(self):
def brushMenu(command):
if command == 'Increase Brush Size' or command =='Decrease Brush Size':
self.canvas.setBrushSize(command)
elif command == 'Pencil':
self.canvas.setPencil()
elif command == 'Eraser':
self.canvas.setEraser()
# Set up a Dialog to choose test dialogs to show
dialog = kytten.Dialog(
kytten.Frame(
kytten.HorizontalLayout([
kytten.Dropdown(['Save File', 'Open File'],
on_select=self.on_select, text="File"),
kytten.Dropdown(['Copy', 'Cut', 'Paste'],
on_select=self.on_select, text="Edit"),
kytten.Dropdown(['Pencil', 'Eraser', 'Increase Brush Size', 'Decrease Brush Size'],
on_select=brushMenu, text="Brush"),
], padding=0, align=kytten.VALIGN_TOP)
),
window=self.window, batch=self.canvas.batch, group=self.fg_group,
anchor=kytten.ANCHOR_TOP_LEFT,
on_mouse_release=self.on_mouse_release,
theme=self.cobalt)
def layerDialog(self):
# Set up a Dialog to choose test dialogs to show
def createLayer():
self.canvas.addLayer()
dialog.teardown()
self.layerDialog()
def focusLayer(foo):
def func():
self.canvas.setCurrentLayer(foo)
return func
def incLayer(foo):
def func():