示例#1
0
 def draw(self, canvas, x, y):
     if self._id is None:
         self._id = canvas.create_image(x, y, image=self._img)
         canvas.update()
     else:
         dx = x - self._pos.getX()
         dy = y - self._pos.getY()
         canvas.move(self._id, dx, dy)
     self.setObjectPos(x, y)
     _root.update()
示例#2
0
 def draw(self, canvas):
     if self._id is None:
         self._id = canvas.create_text(self._pos.getX(),
                                       self._pos.getY(),
                                       {"text": self._text})
     elif self._textChange is True:
         canvas.delete(self._id)
         self._id = canvas.create_text(self._pos.getX(),
                                       self._pos.getY(),
                                       {"text": self._text})
         self._textChange = False
     _root.update()
示例#3
0
 def draw(self, canvas, x, y):
     if self._id is None:
         self.setObjectPos(x, y)
         x1 = self._pos.getX() - self._radius
         y1 = self._pos.getY() - self._radius
         x2 = self._pos.getX() + self._radius
         y2 = self._pos.getY() + self._radius
         self._id = canvas.create_oval(x1, y1, x2, y2,
                                       {"fill": self._fill,
                                        "outline": self._colour})
         canvas.update()
     else:
         dx = x - self._pos.getX()
         dy = y - self._pos.getY()
         canvas.move(self._id, dx, dy)
     self.setObjectPos(x, y)
     _root.update()
示例#4
0
 def draw(self, canvas, x, y):
     if self._id is None:
         self.setObjectPos(x, y)
         x1 = self._pos.getX()
         y1 = self._pos.getY()
         x2 = self._pos.getX() + self._width
         y2 = self._pos.getY() + self._height
         self._id = canvas.create_rectangle(x1, y1, x2, y2,
                                            {"fill": self._fill,
                                             "outline": self._colour})
         canvas.update()
     else:
         dx = x - self._pos.getX()
         dy = y - self._pos.getY()
         canvas.move(self._id, dx, dy)
     self.setObjectPos(x, y)
     _root.update()