Example #1
0
def demo():

    win=Screen()
    #Build display list
    displayList = []
    # rectangle,centered at 0,0
    a = 50.0
    r0 = Rhombus(Point(-a, a),0,1.5*a,2*a, lineWidth=1, lineColor='green', fillColor='aquamarine', showTurtle='False', backgroundColor = 'black')
    displayList.append(r0)
    # draw the same rectangle in the top left corner
    b = 150.0
    r1 = r0.translate1(-b, +b)
    displayList.append(r1)
    # draw the rectangle in the top midlle but rotated
    r2 = r1.rotate1(45).translate1(b,0)
    displayList.append(r2)
    # one more slightly rotated in the top right corner
    r3 = r2.translate1(b,0).rotate1(15)
    displayList.append(r3)
    # same figures in the bottom
    r4 = WithCentre(r1.translate1(0,-2*b),centreColor='red')
    r5 = WithTransparency(r2.translate1(0,-2*b))
    r6 = WithDots(r3.translate1(0, -2 * b), dotColor = 'pink')
    displayList += [r4, r5, r6]


    #WithTransparency(WithCentre(WithDots(r))).draw()
    #Display the list
    for f in displayList:
        f.draw()
    hideturtle()
    done()
Example #2
0
def main():
    from turtle import Screen, done, hideturtle
    from rhombus import Rhombus
    from point import Point
    loz = Rhombus(Point(-150, 200), 0, 100, 40, backgroundColor='Yellow')
    rloz = WithRotation(loz, alpha=90)
    # tests draw
    win = Screen()
    hideturtle()
    loz.draw()
    rloz.draw()
    done()
Example #3
0
def main():
    from turtle import Screen, done, hideturtle
    from rhombus import Rhombus
    from point import Point
    loz = Rhombus(Point(-150, 200), 0, 100, 40, backgroundColor='Yellow')
    tloz = WithTranslation(loz, dx=0, dy=100.0, backgroundColor='Blue')
    print(tloz)
    # tests draw
    win = Screen()
    hideturtle()
    loz.draw()
    tloz.draw()
    done()
Example #4
0
def main():
    from turtle import Screen, done, hideturtle
    from rhombus import Rhombus
    from withtranslation import WithTranslation
    from point import Point
    loz = Rhombus(Point(-150, 200),
                  0,
                  100,
                  40,
                  lineColor='pink',
                  fillColor='blue')
    tploz = WithTransparency(WithTranslation(deepcopy(loz), +100, -100))
    # tests draw
    win = Screen()
    hideturtle()
    loz.draw()
    tploz.draw()
    done()
Example #5
0
def main():
    from turtle import Screen, done, hideturtle
    from rhombus import Rhombus
    from point import Point
    loz = Rhombus(Point(-150, 200), 0, 100, 40, backgroundColor = 'Yellow')
    cloz = WithCentre(loz, centreSize = 12, centreColor = "White")
    tcloz = WithTranslation(cloz, dx=-100, dy= -100)

    ctloz= WithCentre(WithTranslation(cloz, dx=100, dy= -100), centreSize = 12, centreColor = "White")
    # tests draw
    win = Screen()
    hideturtle()
    cloz.draw()
    #test that center and translation do commute
    tcloz.draw()
    ctloz.draw()
    done()
Example #6
0
def main():
    from turtle import Screen, done, hideturtle
    from rhombus import Rhombus
    from point import Point
    from withtranslation import WithTranslation
    loz = Rhombus(Point(-150, 200), 0, 100, 40, backgroundColor='Yellow')
    dloz = WithDots(loz, dotSize=12, dotColor="White")
    tdloz = WithTranslation(dloz, dx=-100, dy=-100)
    dtloz = WithDots(WithTranslation(dloz, dx=100, dy=-100),
                     dotSize=12,
                     dotColor="White")
    # tests draw
    win = Screen()
    hideturtle()
    dloz.draw()
    # test that center and translation do commute
    tdloz.draw()
    dtloz.draw()
    done()
Example #7
0
def main():
    win=Screen()
    #Build display list
    displayList = []

    # check translate
    a = 50.0
    r0 = Rhombus(Point(-a, a), 0, 1.5 * a, 2 * a, lineWidth = 1, lineColor = 'green', fillColor = 'aquamarine',
                 showTurtle = 'False', backgroundColor = 'black')
    displayList.append(r0)

    r0.translate(100,100)
    r0.translate(100, 100)
    r1 = WithTranslation(r0,-200,-200)
    displayList.append(r1)

    # Display the list
    for f in displayList:
        f.draw()
    hideturtle()
    done()
Example #8
0
 def setUp(self) -> None:
     self.r = Rhombus(Point(1, 2), pi / 10, 150, 100, lineColor = "pink", backgroundColor = "green")
Example #9
0
 def setUp(self):
     self.loz = Rhombus(Point(-150, 200), 0, 100, 40)
     self.dloz = WithDots(self.loz, dotSize = 5, dotColor = "Cyan")
     self.maxDiff = None
Example #10
0
 def setUp(self):
     self.loz = Rhombus(Point(-150, 200), 0, 100, 40)
     self.cloz = WithCentre(self.loz, centreSize=12, centreColor="White")
 def setUp(self):
     self.loz = Rhombus(Point(-150, 200), 0, 100, 40)
     self.tloz = WithTranslation(self.loz, dx=0, dy=100.0)
Example #12
0
 def setUp(self):
     self.loz = Rhombus(Point(-150, 200), 0, 100, 40)
     self.trsploz = WithTransparency(self.loz)
Example #13
0
 def setUp(self):
     self.loz = Rhombus(Point(-150, 200), 0, 100, 40)
     self.rloz = WithRotation(self.loz, alpha=45)