本文整理汇总了Python中tkinter.Canvas.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.__init__方法的具体用法?Python Canvas.__init__怎么用?Python Canvas.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Canvas
的用法示例。
在下文中一共展示了Canvas.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, parent):
Canvas.__init__(self, width=WIDTH, height=HEIGHT,
background="black", highlightthickness=0)
self.parent = parent
self.initGame()
self.pack()
示例2: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Canvas.__init__(self, *args, **kwargs)
self.graphs = []
self.x = Axis()
self.y = Axis()
self.y.direction = -1
self.bind("<Configure>", lambda ev: self.after_idle(self.__onConfigure__))
示例3: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master=None, cnf=None, **kw):
if not cnf:
cnf = {}
Canvas.__init__(self, master, cnf, **kw)
self._polygons = list()
self._layer = None
self._image = None
示例4: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, parent):
"""Simple Canvas class."""
Canvas.__init__(self, parent)
self.parent = parent
self.config(background="white", width=960, height=640)
self.num = 1
self.pack()
self.element_list = []
self.bindings()
示例5: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, **kwargs):
"""
Constructor
root - reference to the widget containing this widget
"""
Canvas.__init__(self, **kwargs)
self["bg"] = DEAD_COLOUR
GolCell.__init__(self)
示例6: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master=None, cnf={}, **kw):
Canvas.__init__(self, master, cnf, **kw)
Observable.__init__(self)
self.__boxId = None
self.__start_x = None
self.__start_y = None
self.bind('<Button-1>', self.onButton1Press)
self.bind('<B1-Motion>', self.onMouseMove)
self.bind('<ButtonRelease-1>', self.onButton1Release)
示例7: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master=None, data=None, cell_size=10, color='green'):
self.cell = data if data else [[False]]
self._grid_width = len(self.cell)
self._grid_height = len(self.cell[0])
self._width = self._grid_width * cell_size
self._height = self._grid_height * cell_size
Canvas.__init__(self, master, width=self._width, height=self._height)
self.cell_size = cell_size
self.color = color
self.bind('<Button-1>', self.on_click)
self.bind('<B1-Motion>', partial(self.on_click, motion=True))
self.draw()
示例8: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master, controller, *, height, width, background):
self.is_history_displayed = False
self.height = height
self.width = width
self.controller = controller
self.viewports = []
Canvas.__init__(
self, master, height=height, width=width, background=background)
self.SetupMenu(master)
self.SetNamedView(farg_flags.FargFlags.gui_initial_view or
self.default_initial_view)
if farg_flags.FargFlags.history:
self.TurnOnHistoryGUI(master)
示例9: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, parent, name):
Canvas.__init__(self, parent)
self.parent = parent
self.name = name
self.config(bg="white")
self.info = defaultdict(dict)
self.marked = None
self.sticky_size = (250, 220)
self.stickies = {}
self.lines = {}
self.scale_by = 0
self.bind("<ButtonPress-2>", self.smark)
self.bind("<B2-Motion>", self.sdrag)
self.bind("<Button-3>", self.insert_node)
self.bind("<Button-4>", self.zoom_up)
self.bind("<Button-5>", self.zoom_down)
示例10: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, parent, name, size):
Canvas.__init__(self, parent)
self.parent = parent
self.name = name
self.background = "white"
self.size = size
self.width = size[0]
self.height = size[1]
self.info = defaultdict(dict)
self.num = defaultdict(int)
self.sticky_size = (250, 220)
self.stickies = []
self.lines = {}
self.bind("<ButtonPress-1>", self.smark)
self.bind("<B1-Motion>", self.sdrag)
self.bind("<Button-3>", self.insert_node)
示例11: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master, image):
Canvas.__init__(self, master, width=image.size[0], height=image.size[1])
# fill the canvas
self.tile = {}
self.tilesize = tilesize = 32
xsize, ysize = image.size
for x in range(0, xsize, tilesize):
for y in range(0, ysize, tilesize):
box = x, y, min(xsize, x+tilesize), min(ysize, y+tilesize)
tile = ImageTk.PhotoImage(image.crop(box))
self.create_image(x, y, image=tile, anchor=NW)
self.tile[(x, y)] = box, tile
self.image = image
self.bind("<B1-Motion>", self.paint)
示例12: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, parent, radius, color_on, o_color_on, color_off, o_color_off, off_or_on):
Canvas.__init__(self, parent, borderwidth=0, highlightthickness=0, bg='sky blue')
padding = 0
self.color_on = color_on
self.color_off = color_off
self.o_color_on = o_color_on
self.o_color_off = o_color_on
self.current_color = color_on
self.outline_color = o_color_on
self.light = self.create_oval((3, 3, radius, radius), width=radius/5, fill=self.current_color)
self.set_state(off_or_on)
(x0, y0, x1, y1) = self.bbox("all")
radius = (x1-x0) + padding
self.configure(width=radius, height=radius)
示例13: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, frame, window, background):
self.window = window
Canvas.__init__(self, frame, background=background)
示例14: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self):
Canvas.__init__(self)
示例15: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
def __init__(self, master):
Canvas.__init__(self, master)
self.initializeComponents()