示例#1
0
 def __init__(self,
              canvas: _tk.Canvas,
              x,
              y,
              width,
              height,
              fill="",
              outline=""):
     # noinspection PyProtectedMember
     self.root = canvas._root()
     self._width = width
     self._height = height
     if width == "extend":
         width = canvas.winfo_width()
     if height == "expand":
         height = canvas.winfo_height()
     self.x = x
     self.y = y
     self.root.bind("<Configure>", self._onresize)
     super(CPanel, self).__init__(canvas,
                                  x,
                                  y,
                                  width,
                                  height,
                                  fill=fill,
                                  outline=outline)
示例#2
0
 def __init__(self,
              canvas: _tk.Canvas,
              x,
              y,
              *,
              text,
              anchor="center",
              fill="",
              tags=tuple(),
              font=("Helvetica", 10)):
     # noinspection PyProtectedMember
     self.root = canvas._root()
     self._id = canvas.create_text(x,
                                   y,
                                   text=text,
                                   anchor=anchor,
                                   tags=tags,
                                   fill=fill,
                                   font=font)
     self._canvas: _tk.Canvas = canvas
     self._text: str = text
     self._anchor = anchor
     self._tags = tags
     self._fill = fill
     self._font = font
示例#3
0
 def __init__(self,
              canvas: _tk.Canvas,
              x,
              y,
              *,
              image,
              anchor="center",
              tags=tuple()):
     # noinspection PyProtectedMember
     self.root = canvas._root()
     self._id = canvas.create_image(x,
                                    y,
                                    image=image,
                                    anchor=anchor,
                                    tags=tags)  # , anchor=anchor)
     self._canvas: _tk.Canvas = canvas
     self._image: _t.Union[_PIL.ImageTk.PhotoImage, _tk.PhotoImage] = image
     self._anchor = anchor
     self._tags = tags