当前位置: 首页>>代码示例>>Python>>正文


Python Canvas.__init__方法代码示例

本文整理汇总了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()
开发者ID:gddickinson,项目名称:python_code,代码行数:9,代码来源:nibblesGame.py

示例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__))
开发者ID:basilevs,项目名称:varfill,代码行数:9,代码来源:gui.py

示例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
开发者ID:tobchen,项目名称:LayeredPolygons,代码行数:10,代码来源:view.py

示例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()
开发者ID:Exodus111,项目名称:Projects,代码行数:11,代码来源:stackoverflow.py

示例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)
开发者ID:richlanc,项目名称:Game_of_life,代码行数:11,代码来源:widgets.py

示例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)
开发者ID:xialulee,项目名称:WaveSyn,代码行数:12,代码来源:screenshot.py

示例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()
开发者ID:linsdev,项目名称:pylife,代码行数:14,代码来源:life.py

示例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)
开发者ID:amahabal,项目名称:PySeqsee,代码行数:15,代码来源:central_pane.py

示例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)
开发者ID:Exodus111,项目名称:Projects,代码行数:18,代码来源:gui_items.py

示例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)
开发者ID:Exodus111,项目名称:Projects,代码行数:18,代码来源:load.py

示例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)
开发者ID:gyenney,项目名称:Tools,代码行数:19,代码来源:painter.py

示例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)
开发者ID:xistingsherman,项目名称:SPTOR,代码行数:20,代码来源:LED_light.py

示例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)
开发者ID:X-Scapin,项目名称:BlueP,代码行数:5,代码来源:instance_schema.py

示例14: __init__

# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
	def __init__(self):
		Canvas.__init__(self)
开发者ID:greenfox-velox,项目名称:szepnapot,代码行数:4,代码来源:example.py

示例15: __init__

# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import __init__ [as 别名]
 def __init__(self, master):
     Canvas.__init__(self, master)
     self.initializeComponents()
开发者ID:luizgabriel,项目名称:pong_game,代码行数:5,代码来源:Components.py


注:本文中的tkinter.Canvas.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。