コード例 #1
0
ファイル: cairo_turtle.py プロジェクト: donkirkby/blind-hex
 def __init__(self, canvas, frame):
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     canvas.setLineCap(1) # Round
     self.screen = CairoTurtle._Screen(canvas)
     self.frame = frame
     self.__xoff = self.window_width()/2
     self.__yoff = self.window_height()/2
コード例 #2
0
ファイル: pdf_turtle.py プロジェクト: syohex/live-py-plugin
 def __init__(self, canvas, frame):
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     canvas.setLineCap(1)  # Round
     self.screen = PdfTurtle._Screen(canvas)
     self.frame = frame
     self.__xoff = self.window_width() / 2
     self.__yoff = -self.window_height() / 2
コード例 #3
0
 def __init__(self, canvas, frame=None, width=None, height=None):
     self._window_width = width if width is not None else frame._width
     self._window_height = height if height is not None else frame._height
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     canvas.setLineCap(1)  # Round
     self.screen = PdfTurtle._Screen(canvas)
     self.__xoff = self.window_width()/2
     self.__yoff = -self.window_height()/2
コード例 #4
0
 def switch_off(self):
     """Робить точку невидимою на екрані
     """
     if self._visible:
         self._visible = False
         turtle.up()
         turtle.setpos(self._x, self._y)
         turtle.down()
         turtle.dot(turtle.bgcolor())
コード例 #5
0
 def __init__(self, drawing, width=None, height=None):
     if width is None:
         width = _parse_int(drawing['width'])
     if height is None:
         height = _parse_int(drawing['height'])
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     self.screen = SvgTurtle._Screen(drawing, width, height)
     self.__xoff = self.window_width() / 2
     self.__yoff = -self.window_height() / 2
コード例 #6
0
 def __init__(self, drawing, width=None, height=None):
     if width is None:
         width = _parse_int(drawing['width'])
     if height is None:
         height = _parse_int(drawing['height'])
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     self.screen = SvgTurtle._Screen(drawing, width, height)
     self.__xoff = self.window_width()/2
     self.__yoff = -self.window_height()/2
コード例 #7
0
 def __init__(self, x=0, y=0, heading=0, canvas=None):
     self._path = None
     self._lines_to_draw = []
     TNavigator.__init__(self)
     TPen.__init__(self)
     if canvas == None:
         canvas = Canvas()
     self.screen = MockTurtle._Screen(canvas)
     self.__xoff = self.screen.cv.cget('width')/2
     self.__yoff = self.screen.cv.cget('height')/2
     if x or y:
         self.setx(x)
         self.sety(y)
     self.setheading(heading)
コード例 #8
0
 def __init__(self, x=0, y=0, heading=0, canvas=None):
     self._path = None
     self._lines_to_draw = []
     TNavigator.__init__(self)
     TPen.__init__(self)
     if canvas == None:
         canvas = Canvas()
     self.screen = MockTurtle._Screen(canvas)
     self.__xoff = self.screen.cv.cget('width')/2
     self.__yoff = self.screen.cv.cget('height')/2
     if x or y:
         self.setx(x)
         self.sety(y)
     self.setheading(heading)
コード例 #9
0
 def __init__(self, canvas, frame=None, width=None, height=None):
     if width is None:
         width = frame._width
     if height is None:
         height = frame._height
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     canvas.setLineCap(1)  # Round
     self.screen = PdfTurtle._Screen(canvas, width, height)
     self.__xoff = self.window_width()/2
     self.__yoff = -self.window_height()/2
コード例 #10
0
 def switch_on(self):
     """Робить точку видимою на екрані
     """
     if not self._visible:
         self._visible = True
         turtle.penup()
         turtle.setpos(self._x, self._y)
         turtle.down()
         turtle.dot()
コード例 #11
0
ファイル: mock_turtle.py プロジェクト: dgentry/myDotfiles
 def __init__(self, x=0, y=0, heading=0, canvas=None):
     self._path = None
     self._lines_to_draw = []
     TNavigator.__init__(self)
     TPen.__init__(self)
     if MockTurtle._screen is not None:
         self.screen = MockTurtle._screen
     else:
         self.screen = MockTurtle._Screen(canvas)
     self.stamps = []
     self.__xoff = self.screen.cv.cget('width')/2
     self.__yoff = self.screen.cv.cget('height')/2
     if x or y:
         self.setx(x)
         self.sety(y)
     self.setheading(heading)
     MockTurtle.instances.append(self)
コード例 #12
0
 def __init__(self, drawing, width=None, height=None):
     if width is None:
         width = _parse_int(drawing['width'])
     if height is None:
         height = _parse_int(drawing['height'])
     clip_path = drawing.defs.add(drawing.clipPath(id='border_clip'))
     clip_path.add(drawing.rect(size=(width, height)))
     self._path = None
     self._lines_to_draw = None
     self.screen = None
     TNavigator.__init__(self)
     TPen.__init__(self)
     self.screen = self._Screen(drawing, width, height)
     self.stamps = []
     self.__xoff = self.window_width()/2
     self.__yoff = -self.window_height()/2
     self.color('black', 'black')
コード例 #13
0
 def __init__(self, x=0, y=0, heading=0, canvas=None):
     self._path = None
     self._lines_to_draw = []
     TNavigator.__init__(self)
     TPen.__init__(self)
     if MockTurtle._screen is not None:
         self.screen = MockTurtle._screen
     else:
         self.screen = MockTurtle._Screen(canvas)
     self.stamps = []
     self.__xoff = self.screen.cv.cget('width') / 2
     self.__yoff = self.screen.cv.cget('height') / 2
     if x or y:
         self.setx(x)
         self.sety(y)
     self.setheading(heading)
     MockTurtle.instances.append(self)
コード例 #14
0
 def switch_on(self):
     """Робить коло видимим на екрані
     """
     if not self._visible:
         self._visible = True
         turtle.up()
         turtle.setpos(self._x,
                       self._y - self._r)  # малює починаючи знизу кола
         turtle.down()
         turtle.circle(self._r)
コード例 #15
0
 def reset(self):
     TNavigator.reset(self)
     # noinspection PyUnresolvedReferences,PyProtectedMember
     TPen._reset(self)
     self.screen.cv.report.clear()
コード例 #16
0
                          self._y - self._r)  # малює починаючи знизу кола
            turtle.down()
            turtle.circle(self._r)

    def switch_off(self):
        """Робить коло невидимим на екрані
        """
        if self._visible:
            self._visible = False
            turtle.up()
            turtle.setpos(self._x,
                          self._y - self._r)  # малює починаючи знизу кола
            turtle.down()
            c = turtle.pencolor()
            turtle.pencolor(turtle.bgcolor())
            turtle.circle(self._r)
            turtle.pencolor(c)


# Завершено опис та реалізацію класів
if __name__ == '__main__':
    pause = 50
    turtle.home()
    turtle.delay(pause)
    p = Point(50, 50)
    p.switch_on()
    p.move(-100, 20)
    c = Circle(120, 120, 30)
    c.switch_on()
    c.move(-30, -140)
コード例 #17
0
 def switch_off(self):
     """Робить коло невидимим на екрані
     """
     if self._visible:
         self._visible = False
         turtle.up()
         turtle.setpos(self._x,
                       self._y - self._r)  # малює починаючи знизу кола
         turtle.down()
         c = turtle.pencolor()
         turtle.pencolor(turtle.bgcolor())
         turtle.circle(self._r)
         turtle.pencolor(c)