User:Madsoj15

From rtgkomArkiv
Jump to: navigation, search

Blomst[edit]

http://rtgkom.dk/~madsoj15/img/helloworld/result1_200x9.PNG http://rtgkom.dk/~madsoj15/img/helloworld/result2_200x128.PNG

Kildekode[edit]

import turtle
import math
import random
p=random.randint(2,10)
x=float(input("Hvor bred skal bladene være?"))
y=float(x*0.095)
f=x+150
g=x-250
s=random.randint(4,20)
wn = turtle.Screen()
turtle.screensize(1000,1000)
turtle.bgcolor("#07c7f2")
jesse=turtle.Turtle()
jesse.shape("circle")
jesse.pu()
jesse.speed(0)
def kroneblad(x, y, z):
    #grass
    jesse.begin_fill()
    jesse.fillcolor("#138c1b")
    jesse.pd()
    jesse.goto(-1000,0)
    jesse.rt(90)
    jesse.forward(500)
    jesse.left(90)
    jesse.forward(2000)
    jesse.left(90)
    jesse.forward(500)
    jesse.left(90)
    jesse.forward(2000)
    jesse.end_fill()
    jesse.pu()
    
    #mountain
    for i in range(-5,2,3):
        jesse.setpos(f*i+150,0)
        jesse.pd()
        jesse.begin_fill()
        jesse.fillcolor("#949e9d")
        jesse.goto(f*i,f+150)
        jesse.goto(f*i-250,0)
        jesse.end_fill()
        jesse.pu()

    #sun
    jesse.setpos(-450,450)
    jesse.begin_fill()
    jesse.fillcolor("yellow")
    jesse.circle(50)
    jesse.end_fill()
    jesse.setpos(-450,400)
    jesse.pensize(5)
    jesse.color("#e1e572")
    for i in range(s):
        jesse.rt(360/s)
        jesse.forward(60)
        jesse.pd()
        jesse.forward(100)
        jesse.pu()
        jesse.backward(160)
    jesse.pu()
    #flower
    jesse.setpos(0,-500)
    jesse.pensize(5)
    jesse.pd()
    jesse.color("#d7ea69")
    jesse.goto(0,-250)
    jesse.shapesize(x,y,z)
    for i in range(p):
        jesse.begin_fill()
        jesse.fillcolor("white")
        jesse.stamp()
        jesse.end_fill()
        jesse.rt(360/p)
    jesse.shape("circle")
    jesse.resizemode("auto")
    jesse.color("#544804")
    jesse.stamp()

kroneblad(x,y,5)

wn.mainloop()