Hello friends, I'm currently in Tech class doing a project on a very old version of python and need help animating a moving object. I have no idea what to do please help i need to create a winter wonderland Landscape with a cabin, trees, a chimney with active smoke and children playing on a pond. I orginally wanted to find a code that could allow me to draw with my mouse to avoid having to repeat certain codes over again but i failed to find anything that would work. Honestly anything that can move in the python 2.7.6 turtle program would help. Live Long and prosper - D this is what i have so far bear in mind that i am truly a scrub and this code is very mediocre `from turtle import *
import random

HOUSE

from turtle import *
speed(10)
up()
goto(300,100)
down()
right(90)
fd(100)
rt(90)
fd(200)
rt(90)
fd(100)
rt(90)
fd(200)
lt(120)
fd(150)
lt(120)
fd(150)
rt(60)
fd(50)
rt(120)
fd(100)
rt(120)
fd(50)

CHIMNEY

up()
goto(283,180)
down()
lt(330)
forward(45)
right(90)
forward(20)
right(90)
forward(45)
left(90)
forward(10)
right(90)
forward(5)
right(90)
forward(40)
right(90)
forward(5)
right(90)
forward(10)

CHRISTMAS TREE

up()
goto(-200,80)
down()
forward(25)
right(90)
forward(20)
left(90)
forward(65)
right(145)
forward(70)
left(145)
forward(50)
right(145)
forward(65)
left(145)
forward(35)
right(145)
forward(65)
right(70)
forward(65)
right(145)
forward(35)
left(145)
fd(70)
rt(145)
fd(55)
lt(145)
fd(65)
rt(145)
fd(65)
lt(90)
fd(25)

CHRISTMAS TREE 2

rt(90)
up()
goto(-50,80)
down()
forward(25)
right(90)
forward(20)
left(90)
forward(65)
right(145)
forward(70)
left(145)
forward(50)
right(145)
forward(65)
left(145)
forward(35)
right(145)
forward(65)
right(70)
forward(65)
right(145)
forward(35)
left(145)
fd(70)
rt(145)
fd(55)
lt(145)
fd(65)
rt(145)
fd(65)
lt(90)
fd(25)

CHRISTMAS TREE 3

rt(90)
up()
goto(-150,-50)
down()
forward(25)
right(90)
forward(20)
left(90)
forward(65)
right(145)
forward(70)
left(145)
forward(50)
right(145)
forward(65)
left(145)
forward(35)
right(145)
forward(65)
right(70)
forward(65)
right(145)
forward(35)
left(145)
fd(70)
rt(145)
fd(55)
lt(145)
fd(65)
rt(145)
fd(65)
lt(90)
fd(25)

CRISTMAS TREE 4

rt(90)
up()
goto(0,-50)
down()
forward(25)
right(90)
forward(20)
left(90)
forward(65)
right(145)
forward(70)
left(145)
forward(50)
right(145)
forward(65)
left(145)
forward(35)
right(145)
forward(65)
right(70)
forward(65)
right(145)
forward(35)
left(145)
fd(70)
rt(145)
fd(55)
lt(145)
fd(65)
rt(145)
fd(65)
lt(90)
fd(25)

GROUND

up()
goto(0,-100)
down()
rt(90)
fd(2000)
bk(2000)
rt(180)
fd(2000)
up()

`

I have no idea what you want either. You have a simple code section (which doesn't look like it is properly indented). Do you have Python Turtle in your computer?

Yes, although it is a very old version 2.7.6 I really just want to know if there is an easy way to animate.

Hmm... Sorry, nope. That looks like the simpliest way to do. You could try to optimize but you gain nothing much but rather a complicated set of code...

You could use some functions ... maybe something like this to start:

from turtle import *
from math import *

speed(5)

def rectangle( x, y, w, h ):
    up()
    goto( x, y )
    setheading(0)
    down()
    for repeat in range( 2 ):
        fd(w)
        left(90)
        fd(h)
        left(90)

def peak( x, y, w, h ):
    up()
    goto( x, y )
    down()
    goto(x+w/2, y+h)
    goto( x+w, y )

#HOUSE
rectangle( 100, 0, 200, 100 )
peak( 100, 100, 200, 60 )


def tree( x, y, w, h ):
    up()
    goto( x, y+h )
    down()
    setheading( -45 )
    for repeat in range(3):
        fd( .9*h/4/cos(45) )
        rt(180-45)
        fd( w/3 )
        left( 180-45 )
    up()
    goto( x, y+h )
    down()
    setheading( (45+180) )
    for repeat in range(3):
        fd( .9*h/4/cos(45) )
        left(180-45)
        fd( w/3 )
        right( 180-45 )
    setheading(0)
    fd(.9*w)
    rectangle(x-w/20, y, w/10, h/10 )

tree( -50, 0, 100, 160 )
tree( -250, 0, 100, 160 )
tree( -250, -200, 100, 140 )
tree( -50, -200, 80, 120 )
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.