Пример #1
0
def move_turtles(color, thickness):
    window = rg.TurtleWindow()
    turtle1 = rg.SimpleTurtle()
    turtle1.pen = rg.Pen('green', thickness)
    turtle2 = rg.SimpleTurtle()
    turtle2.pen = rg.Pen(color, 5)
Пример #2
0
#    - Makes the SimpleTurtle put its pen DOWN
#         (so that the next movements will return to leaving a "trail").
#
#    - Makes the SimpleTurtle's pen have color 'green' and thickness 10.
#
#    - Makes the SimpleTurtle go 150 pixels straight DOWN.
#
#   Don't forget to:
#     - import rosegraphics and construct a TurtleWindow
#          at the BEGINNING of your code, and to
#     - ask your TurtleWindow to   close_on_mouse_click
#          as the LAST line of your code.
#   See the beginning and end of m4e_loopy_turtles for an example.
#
#   As always, test by running the module.
#   As always, COMMIT-and-PUSH when you are done with this module.
#
########################################################################

import rosegraphics as rg
window = rg.TurtleWindow()
bob = rg.SimpleTurtle('turtle')
bob.pen = rg.Pen('blue', 5)
bob.left(90)
bob.forward(200)
bob.pen_up()
bob.go_to(rg.Point(100, -40))
bob.pen_down()
bob.pen = rg.Pen('green' , 10)
bob.backward(150)
def russia():
    window = rg.TurtleWindow()
    octrevolution('green')
    fiveyearplan(5)
    window.close_on_mouse_click()
Пример #4
0
def main():
    window = rg.TurtleWindow()
    creating_turtle("turtle", "blue", 100)
    creating_turtle("square", "red", 50)
    window.close_on_mouse_click()
Пример #5
0
def pn(color, thickness):
    window = rg.TurtleWindow()
def try_methods_and_functions():
    # IMPORTANT: Read the NOTE below before you try to solve this TO-DO!
    """
    Constructs a SimpleTurtle and sets its   pen  to a new rg.Pen
    that is 'blue' with thickness 5.

    Then makes the SimpleTurtle do the following (in the order listed):

      1. Go  backward  150 units.

      2. Change its speed to 1 (slowest).
         Draw 2 squares whose size (width and height) are 100,
         each "twisted" from the previous by 30 degrees.

      3. Change its speed to 5 (faster).
         Change its Pen's color to 'red'.
         Draw 10 squares whose size (width and height) are 50,
         each "twisted from the previous by 15 degrees.

      4. Change its speed to 100 (about the fastest possible).
         Change its Pen's thickness to 35.
         Draw 8 squares whose size (width and height) are 300,
         each "twisted" from the previous by 60 degrees.

      5. Change its Pen to be a NEW Pen whose color is 'black'
         and whose thickness is 3.

      6. Go backward  200 units.

      7. Draw a CIRCLE whose radius is 30.

      8. Draw a SQUARE whose sides are each of length 50.
    """
    ###########################################################################
    # TODONE: 5. Implement and test this function, per its doc-string above.
    #   The testing code (in main) is already written for you.
    #
    #   NOTE: This function should ** CALL ** the
    #     draw_many_squares
    #   function defined above.  If you don't see why, ** ASK FOR HELP. **
    ###########################################################################

    rg.TurtleWindow()
    joe = rg.SimpleTurtle()

    joe.pen = rg.Pen('blue', 5)

    joe.backward(150)
    joe.speed = 1
    draw_many_squares(joe, 2, 100, 30)

    for x in range(10):
        joe.speed = 5
        joe.pen = rg.Pen('red', 3)

        joe.draw_square(50)
        joe.left(15)

    for x in range(8):
        joe.speed = 100
        joe.pen = rg.Pen('red', 35)

        joe.draw_square(300)
        joe.left(60)

    joe.pen = rg.Pen('black', 3)
    joe.backward(200)

    joe.draw_circle(30)

    joe.draw_square(50)
#   On Line 5 above, replace  PUT_YOUR_NAME_HERE  with your own name.
###############################################################################

###############################################################################
# done: 2.
#   You should have RUN the  m5e_loopy_turtles  module and READ its code.
#   (Do so now if you have not already done so.)
#
#   Below this comment, add ANY CODE THAT YOU WANT, as long as:
#     1. You construct at least 2 rg.SimpleTurtle objects.
#     2. Each rg.SimpleTurtle object draws something
#          (by moving, using its rg.Pen).  ANYTHING is fine!
#     3. Each rg.SimpleTurtle moves inside a LOOP.
import rosegraphics as rg

window = rg.TurtleWindow()

blue_turtle = rg.SimpleTurtle('turtle')
blue_turtle.pen = rg.Pen('midnight blue', 3)
blue_turtle.speed = 25  # Fast

size = 100

for k in range(13):
    blue_turtle.draw_circle(size)
    blue_turtle.pen_up()
    blue_turtle.right(90)
    blue_turtle.forward(20)
    blue_turtle.left(90)
    blue_turtle.pen_down()
    size = size - 7
Пример #8
0
#    - Makes the SimpleTurtle put its pen DOWN
#         (so that the next movements will return to leaving a "trail").
#
#    - Makes the SimpleTurtle's pen have color 'green' and thickness 10.
#
#    - Makes the SimpleTurtle go 150 pixels straight DOWN.
#
#   Don't forget to:
#     - import rosegraphics and construct a TurtleWindow
#          at the BEGINNING of your code, and to
#     - ask your TurtleWindow to   close_on_mouse_click
#          as the LAST line of your code.
#   See the beginning and end of m4e_loopy_turtles for an example.
#
#   As always, test by running the module.
#   As always, COMMIT-and-PUSH when you are done with this module.
#
########################################################################
import rosegraphics as rg
windows = rg.TurtleWindow()
sturtle = rg.SimpleTurtle('turtle')
sturtle.pen = rg.Pen('blue', 10)
sturtle.left(angle=90)
sturtle.forward(200)
sturtle.pen_up()
sturtle.go_to(rg.Point(100, -40))
sturtle.pen_down()
sturtle.pen = rg.Pen('green', 10)
sturtle.left(angle=180)
sturtle.forward(150)
windows.close_on_mouse_click()
def turtle_things(color, thickness):
    window = rg.TurtleWindow()
    another_turtle = rg.SimpleTurtle('triangle')
    another_turtle.backward(100)

    window.close_on_mouse_click()
def bill_the_turtle(a, b):
    window = rg.TurtleWindow()
    bill = rg.SimpleTurtle('turtle')
    bill.pen = rg.Pen(a, b)
    bill.backward(100)
    window.close_on_mouse_click()
def geoffery_the_turtle(a, b):
    window = rg.TurtleWindow()
    geoffery = rg.SimpleTurtle('turtle')
    geoffery.pen = rg.Pen(a, b)
    geoffery.forward(100)
    window.close_on_mouse_click()