2017PrgC36 Blomst med Turtle-modulet

From rtgkomArkiv
Jump to: navigation, search

Upload mindst den sidste prototype som du lavede, båd koden og et skærmbillede (udklip af) som viser blomsten.

NB, billederne skal uploades til jeres StudieWebs og så linkes til her fra wiki'en med den syntax som I kan se her:

http://rtgkom.dk/~gkb/billeder/blomst_lille.png

Andreas Johan Bergström[edit]

[1]

Her er min kildekode

import turtle from turtle import * wn = turtle.Screen() wn.bgcolor("light blue") wn.title("Landscape") wn.setup(width = 1.0, height = 1.0) turtle.speed(0) turtle.screensize(1200,800)

def sol():

   turtle.pu()
   turtle.home()
   turtle.fd(450)
   turtle.pd()
   begin_fill()
   color("yellow")
   turtle.circle(150)
   end_fill()
   turtle.color("black")
   

sol()

n_solstråler=18 def sol_stråler():

   for i in range(n_solstråler):
       turtle.pu()
       turtle.rt(90)
       turtle.fd(15)
       turtle.pd()
       turtle.pensize(7)
       turtle.color("yellow")
       turtle.fd(120)
       turtle.pu()
       turtle.backward(135)
       turtle.lt(90)
       turtle.circle(150,360/n_solstråler)

sol_stråler()

turtle.color("black") turtle.pensize(1)

def eng():

   turtle.pu()
   turtle.home()
   turtle.lt(90)
   turtle.fd(50)
   turtle.pd()
   turtle.rt(90)
   turtle.begin_fill()
   turtle.fillcolor("green")
   for i in range(2):
       turtle.fd(1000)
       turtle.rt(90)
       turtle.fd(1000)
       turtle.rt(90)
       turtle.fd(1000)
   turtle.end_fill()
   

eng()

def stilk():

   turtle.pu()
   turtle.home()
   turtle.pd()
   turtle.color("white")
   turtle.begin_fill()
   turtle.fillcolor('#0b5b03')
   for i in range(2):
       turtle.fd(5)
       turtle.rt(90)
       turtle.fd(400)
       turtle.rt(90)
       turtle.fd(2)
   turtle.end_fill()

stilk()

def kronblade():

   turtle.pu()
   turtle.home()
   turtle.pd()    
   for i in range(18):
       turtle.shape("circle")
       turtle.shapesize(3,15,1)
       turtle.color("yellow")
       turtle.fillcolor("red")
       turtle.stamp()
       turtle.right(360/18)
       

kronblade()

def blomstermidte():

   turtle.pu()
   turtle.home()
   turtle.pd()
   turtle.shapesize(5,5,1)
   turtle.color("white")
   turtle.fillcolor("yellow")
   turtle.stamp()
   #turtle.pu()
   #turtle.fd
   #turtle.shape("circle")
   

blomstermidte()


wn.exitonclick()

Jakob A. Poulsgærd[edit]

Blomster landskab:
http://rtgkom.dk/~jakobap15/turtlebilleder/lille_blomst.png

Skærmbillede af kildekode:
http://rtgkom.dk/~jakobap15/turtlebilleder/lille_kildekode.png

Skærmbillede af shell:
http://rtgkom.dk/~jakobap15/turtlebilleder/lille_shelloutput.png

Kildekode:

import random
from random import randint
import math
import turtle

colors = ["white", "#ffc1cd", "#ffbf91", "#ff9e9e"]
hast = float(input('Animations hastighed: '))
n_skyer = int(input('Antal skyer: '))
n_strå = int(input('Antal græsstrå: '))

turtle.setup(1000, 1000)

wn = turtle.Screen()
bob = turtle.Turtle()
brian = turtle.Turtle()

bob.speed(hast)
bob.penup()
bob.hideturtle()

brian.speed(hast)
brian.penup()
brian.hideturtle()

def blad(radius):
	bob.pendown()
	#bob.color("#ffb366")
	bob.shape("triangle")
	bob.shapesize(1, 1)
	bob.begin_fill()
	bob.fillcolor("#ffb366")
	bob.circle(radius, None, 6)
	bob.end_fill()
	#skygge
	bob.begin_fill()
	bob.fillcolor("#ffa64d")
	bob.circle(radius/2+5, None, 6)
	bob.end_fill()

def nyBlad():
        bob.pendown()
        bob.color("#ffa64d")
        bob.shape("circle")
        bob.shapesize(11, 4)
        bob.stamp()
        #skygge
        bob.color("#ff9933")
        bob.shapesize(9, 3.5)
        bob.stamp()

def stilk():
        bob.up()
        bob.setpos(-400, -400)
        bob.color("#aaff80")
        bob.pensize(10)
        d = 1
        r = 0
        for i in range(12):
                r = r + 1
                bob.circle(400, r)
                if r > 6:
                        bob.down()
        #skygge
        bob.penup()
        bob.home()
        bob.setpos(-400, -405)
        bob.color("#99ff66")
        bob.pensize(5)
        d = 1
        r = 0
        for i in range(12):
                r = r + 1
                bob.circle(400, r)
                if r > 6:
                        bob.down()

def stilk_blomst(placering, side):
        bob.penup()
        bob.setpos(side, -400)
        bob.shape("circle")
        bob.shapesize(5, 2)
        bob.color("#a2ff59")
        bob.circle(400, placering)
        bob.stamp()

def sol(radius):
        brian.circle(radius)

#baggrund
def baggrund():
        wn.bgcolor("#aff0ff")
        #sol
        brian.penup()
        brian.setpos(300, 85)
        radius = 250
        move = 50
        for g in range(5):
                if g == 0:
                        brian.begin_fill()
                        brian.fillcolor("#cefcff")
                        sol(radius)
                        brian.end_fill()
                elif g == 1:
                        brian.begin_fill()
                        brian.fillcolor("#f7feff")
                        sol(radius)
                        brian.end_fill()
                elif g == 2:
                        brian.begin_fill()
                        brian.fillcolor("#fffced")
                        sol(radius)
                        brian.end_fill()
                elif g == 3:
                        brian.begin_fill()
                        brian.fillcolor("#fff7af")
                        sol(radius)
                        brian.end_fill()
                elif g == 4:
                        brian.begin_fill()
                        brian.fillcolor("#fff177")
                        sol(radius)
                        brian.end_fill()
                brian.lt(90)
                brian.forward(move)
                brian.rt(90)
                radius = radius - move
                move = move - 12
        #sky
        x = randint(-300, 400)
        y = randint(75, 250)
        brian.penup()
        brian.home()
        brian.setpos(x, y)
        brian.pendown()
        brian.lt(90)
        brian.begin_fill()
        for i in range(n_skyer):
                color = random.choice(colors)
                if brian.ycor() < y:
                        x = randint(-300, 400)
                        y = randint(75, 250)
                        brian.end_fill()
                        brian.penup()
                        brian.home()
                        brian.lt(90)
                        brian.setpos(x, y)
                        brian.pendown()
                        brian.begin_fill()
                        brian.color(color)
                while brian.ycor() >= y:
                        brian.color(color)
                        brian.circle(randint(10, 25), randint(95, 160))
                        brian.rt(randint(105, 120))
        brian.end_fill()
        #vulkan
        brian.color("grey")
        brian.shape("triangle")
        brian.penup()
        brian.home()
        brian.lt(90)
        brian.pendown()
        x = -400
        for i in range(5):
                brian.penup()
                brian.setpos(x, -100)
                brian.pendown()
                bredde = randint(10, 20)
                brian.shapesize(bredde, 5)
                brian.stamp()
                x = x + 20
        brian.penup()
        brian.home()
        #græs
        brian.color("#79ce37")
        brian.setpos(-500, -100)
        brian.pendown()
        brian.begin_fill()
        brian.fillcolor("#79ce37")
        for h in range(4):
                brian.forward(1000)
                brian.rt(90)
        brian.end_fill()

#blomster skygge
def blomst_skygge():
        bob.penup()
        bob.home()
        bob.shape("circle")
        bob.shapesize(3, 10)
        bob.color("#69b92d")
        bob.setpos(-200, -385)
        bob.pendown()
        bob.stamp()
        bob.penup()
        bob.setpos(-210, -385)
        bob.pendown()
        bob.shapesize(2.5, 9.5)
        bob.color("#79ce37")
        bob.stamp()
        bob.penup()
        bob.setpos(-210, -355)
        bob.pendown()
        bob.begin_fill()
        bob.fillcolor("#79ce37")
        bob.rt(90)
        for h in range(4):
                bob.forward(75)
                bob.rt(90)
        bob.end_fill()
        bob.lt(90)
        bob.penup()
        bob.setpos(-140, -385)
        bob.pendown()
        bob.shapesize(.4, 3)
        bob.color("#69b92d")
        bob.stamp()
        bob.penup()
        bob.setpos(-265, -410)
        bob.pendown()
        bob.shapesize(1.5, 10)
        bob.color("#69b92d")
        bob.stamp()

#antal blade
n_blad = 4

#blomsten
def blomst():
        #skygge på jorden
        blomst_skygge()
        #græsstrå
        brian.penup()
        brian.home()
        brian.pendown()
        for h in range(n_strå):
                brian.penup()
                brian.home()
                brian.pendown()
                brian.pensize(randint(3, 6))
                x = randint(-500, 500)
                y = randint(-480, -110)
                brian.penup()
                brian.setpos(x, y)
                brian.pendown()
                længde = randint(10, 15)
                brian.lt(40)
                brian.color("#69b92d")
                brian.forward(længde-3)
                brian.lt(45)
                brian.color("#9edc6f")
                brian.forward(længde)
        #stilk
        stilk()
        #ydre blade
        bob.penup()
        bob.home()
        bob.pendown()
        bob.pensize(1)
        for i in range(n_blad):
                bob.rt(45)
                nyBlad()
        #indre blade
        for i in range (n_blad):
                bob.rt(90)
                blad(40)
        bob.lt(90)
        bob.penup()
        bob.home()
        bob.pendown()
        stilk_blomst(65, -460)
        #midten
        bob.shape("circle")
        bob.shapesize(1.5, 1.5)
        bob.color("#ffdab3")
        bob.penup()
        bob.home()
        bob.stamp()

baggrund()
blomst()

wn.exitonclick()

Jannik Taulan Nielsen[edit]

Billede af min blomst:

http://www.rtgkom.dk/~janniktn15/python_blomst/blomst_billede.png

Her ses min kildekode:

			import turtle
			turtle.speed(0)
			turtle.tracer(0)
			def kvadrat():
	    			turtle.pendown()
	    			turtle.begin_fill()
	    			turtle.fillcolor("yellow")
	    			turtle.pencolor("yellow")
	    			for i in range(4):
	        			turtle.forward(100)
	        			turtle.right(90)
	    			turtle.penup()
	    			turtle.end_fill()
    
			kvadrat() 

			def blomst():
	    			turtle.home()
	    			for i in range(32):
	        		kvadrat()
	        		turtle.right(360/32)
	        		turtle.forward(5)     
			blomst()

			def stilk():
	    			turtle.speed(10)
	    			turtle.begin_fill()
	    			turtle.fillcolor("#0B610B")
	    			turtle.pencolor("#0B610B")
	    			turtle.penup()
	    			turtle.forward(3)
	    			turtle.right(90)
	    			turtle.forward(50)
	    			turtle.pendown()
	    			turtle.forward(250)
		    		turtle.right(90)
		    		turtle.forward(10)
		    		turtle.right(90)
		    		turtle.forward(250)
		    		turtle.penup()
		    		turtle.forward(50)
		    		turtle.right(90)
		    		turtle.forward(5)
		    		turtle.end_fill()

			stilk()

			def cirkeler():
		    		turtle.left(90)
		    		turtle.forward(65)
		    		turtle.left(90)
		    		turtle.begin_fill()
		    		turtle.circle(90)
		    		turtle.fillcolor("#8A4B08")
		    		turtle.end_fill()
		    		turtle.right(90)
		    		turtle.backward(40)
		    		turtle.begin_fill()
		    		turtle.fillcolor("#3B240B")
		    		turtle.left(90)
		    		turtle.circle(50)
		    		turtle.end_fill()
		    		turtle.right(90)
		    		turtle.backward(25)
		    		turtle.left(90)
		    		turtle.begin_fill()
		    		turtle.circle(25)
		    		turtle.fillcolor("black")
		    		turtle.end_fill()

			cirkeler()

Kristian Danborg Kestler[edit]

Ludvig Valdemar Krochin Goldschmidt Sørensen[edit]

Her er den blomst jeg har lavet i forløbet med Turtle-modulet:

https://i.imgur.com/LhdamECb.png

Herunder ses koden der bygger den ovenstående blomst:

    import turtle

    #Baggrund
    turtle.bgcolor("lightblue")

    #Solen
    sun = turtle.Turtle()
    sun.penup()
    sun.left(115)
    sun.forward(320)
    sun.begin_fill()
    sun.pendown()
    sun.pencolor("lightblue")

    for i in range(1):
        sun.circle(130)
        sun.fillcolor("yellow")
        sun.hideturtle()
        sun.end_fill()

    #Initial
    turtle.pendown()
    turtle.speed(20)
    turtle.setheading(270)
    turtle.pencolor("darkgreen")
    turtle.pensize(4)
    turtle.forward(200)
    turtle.setheading(90)
    turtle.forward(200)
    turtle.pensize(1)
    turtle.pencolor("black")

    #Funktion for at tegne trekant
    def triangle(line_length,color):
        turtle.pendown()
        for i in range(3):
            turtle.forward(line_length)
            turtle.right(120)
            turtle.begin_fill()
            turtle.fillcolor(color)
            turtle.stamp()
            turtle.end_fill()
        turtle.right(30)

    #Lav selve blomst
    for i in range(13):
        triangle(75, "purple")

    for i in range(13):
        triangle(60, "yellow")
        
    for i in range(13):
        triangle(50, "red")

    for i in range(13):
        triangle(35, "blue")

    for i in range(13):
        triangle(20, "green")

    for i in range(13):
        triangle(10, "pink")

    turtle.setheading(270)
    turtle.pencolor("brown")
    turtle.penup()
    turtle.pensize(99)
    turtle.forward(250)
    turtle.pendown()
    turtle.right(90)
    turtle.forward(400)
    turtle.right(180)
    turtle.forward(800)
    turtle.penup()

Lukas Hammerlund Christophersen[edit]

Mads Paludan[edit]

Her er grafikken af min blomst

http://www.rtgkom.dk/~madsp15/wikibilled/thumpnailblomst.png

Her er min kode til blomsten

import turtle

#window
wn=turtle.Screen()
wn.bgcolor("blue")
wn.title("Flower")

#turtles
midte=turtle.Turtle()
stilk=turtle.Turtle()
blad=turtle.Turtle()
jord=turtle.Turtle()
sol=turtle.Turtle()
sols=turtle.Turtle()
bjerg=turtle.Turtle()

#circle in the middle
midte.pensize(3)
midte.begin_fill()
midte.color("brown")
midte.circle(40, 360, 40)
midte.end_fill()

#Stilk
stilk.color("spring green")
stilk.penup()
stilk.setpos(-100, -100)
stilk.pendown()
stilk.pensize(3)
stilk.circle(100, 90, 40)

#Leaf
blad.color("yellow")
blad.shape("circle")
blad.shapesize(2,1,1)


for i in range(27):
    blad.forward(9)
    blad.left(13)
    blad.stamp()

#Grass
jord.color("#26e226")
jord.penup()
jord.setpos(-400, -100)
jord.pendown()
jord.begin_fill()
jord.pensize(3)
jord.forward(800)
jord.right(90)
jord.forward(300)
jord.right(90)
jord.forward(800)
jord.right(90)
jord.forward(300)
jord.end_fill()

#Sun
sol.color("yellow")
sol.penup()
sol.setpos(300, 200)
sol.pendown()
sol.begin_fill()
sol.circle(40, 360, 40)
sol.end_fill()

#Sunshine
sols.color("yellow")
sols.pensize(5)

for i in range(8):
    sols.penup()
    sols.setpos(300, 240)
    sols.pendown()
    sols.right(45)
    sols.forward(100)

#Mountain
bjerg.color("grey")
bjerg.penup()
bjerg.setpos(100, -100)
bjerg.pendown()
bjerg.begin_fill()
bjerg.left(45)
bjerg.forward(200)
bjerg.right(90)
bjerg.forward(200)
bjerg.end_fill()

Mads Østergaard Jørgensen[edit]

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()

Magnus Thor Troest[edit]

Martin Schaadt Wind[edit]

Mathias Brandt Thomsen[edit]

Mathias Elmhauge Petersen[edit]

Billede af min Blomst[edit]

https://i.imgur.com/TokSK6x.png

Kildekode[edit]

import turtle

wn = turtle.Screen()
ib = turtle.Turtle()

turtle.screensize(500, 500)
wn.bgcolor("blue")
ib.speed(0)
nBlade = int(input("Hvor mange blade skal blomsten have?"))
turtle.tracer(3, 1)


def graes():
    ib.pu()
    ib.setpos(-500, -500)
    ib.setheading(0)
    ib.fillcolor("green")
    ib.pd()
    ib.begin_fill()
    ib.fd(1000)
    ib.lt(90)
    ib.fd(250)
    ib.lt(90)
    ib.fd(1000)
    ib.lt(90)
    ib.fd(250)
    ib.end_fill()
    ib.pu()
graes()

def Kroneblad():
    ib.pd()
    ib.pencolor("yellow")
    ib.forward(99)
    ib.left(120)
    ib.pencolor("red")
    ib.stamp()
    ib.forward(99)
    ib.left(120)
    ib.pencolor("yellow")
    ib.forward(99)
    ib.circle(50, 360)
    ib.pu()

def Sky():
    ib.pu()
    ib.setpos(-50, 90)
    ib.setheading(-70)
    ib.pd()
    ib.fillcolor("white")
    ib.begin_fill()
    
    for _ in range(18):
        ib.lt(3)
        ib.bk(5)
        
    ib.setheading(-90)

    for _ in range(30):
        ib.lt(3)
        ib.bk(5)
        
    ib.setheading(-90)
    
    for _ in range(60):
        ib.lt(3)
        ib.bk(6)
        
    ib.setheading(0)
    
    for _ in range(30):
        ib.lt(3)
        ib.bk(6)
    
    ib.setheading(0)
     
    for _ in range(25):
        ib.lt(3)
        ib.bk(6)

        
    ib.setheading(0)
    ib.end_fill()
    ib.pu()
Sky()

def Bjerg2():
    ib.pu()
    ib.setpos(-70, -250)
    ib.setheading(120)
    ib.fillcolor("purple")
    ib.pd()
    ib.begin_fill()
    ib.fd(400)
    ib.lt(120)
    ib.fd(400)
    ib.end_fill()
    ib.pu()
Bjerg2()


def sol():
    ib.setpos(200, 260)
    ib.pd()
    ib.begin_fill()
    ib.fillcolor("orange")
    ib.circle(70, 360, 100)
    ib.end_fill()
    ib.pu()
    
sol()

def stilk():
    ib.setpos(230, 0)
    ib.pd()
    ib.setheading(0)
    ib.right(90)
    ib.pencolor("darkgreen")
    ib.pensize( width = 5)
    ib.forward(300)
    ib.pu()
    ib.setpos(230, 0)
    ib.pensize( width = 1)
    
    for i in range(nBlade):
        ib.left(360/nBlade)
        Kroneblad()

   
stilk()

turtle.update()

Michael Lunddorf Kayser[edit]

Michael Maurer[edit]

http://rtgkom.dk/~michaelm15/blomst.jpg

import turtle
import random
from turtle import *
turtle.screensize(500, 500, "#80dfff")
turtle.speed(0)
turtle.setup(width = 1.0, height = 1.0)


#tegn regnbue
turtle.left(180)
turtle.forward(400)
turtle.left(90)
begin_fill()
color("black","red")
turtle.circle(400)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","orange")
turtle.circle(385)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","yellow")
turtle.circle(370)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","green")
turtle.circle(355)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","cyan")
turtle.circle(340)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","blue")
turtle.circle(325)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","purple")
turtle.circle(310)
end_fill()

turtle.left(90)
turtle.forward(15)
turtle.right(90)
begin_fill()
color("black","#80dfff")
turtle.circle(295)
end_fill()
turtle.color("white")
turtle.penup()
turtle.left(90)
turtle.forward(295)
turtle.right(180)
turtle.pendown()
turtle.left(180)

#græs
color("darkgreen","#79ff4d")
begin_fill()
turtle.forward(1000)
turtle.right(90)
turtle.forward(1000)
turtle.right(90)
turtle.forward(2000)
turtle.right(90)
turtle.forward(1000)
turtle.right(90)
turtle.forward(1000)
end_fill()

#stilk
turtle.color("#33cc00")
turtle.pensize(15)
turtle.right(90)
turtle.forward(200)
turtle.penup()
turtle.right(180)
turtle.forward(200)
turtle.pendown()
turtle.pensize(1)


#Definer blade
turtle.pensize(2)
def kroneblad(radius):
    turtle.circle(radius, steps=6)

#Tegn blade
n_blade = 5
color("darkorange", "teal")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(10)
        turtle.left(360/n_blade)
        kroneblad(50)

blomst()
end_fill()
turtle.pensize(1)

#Tegn sol
turtle.penup()
turtle.forward(300)
turtle.left(90)
turtle.forward(600)
turtle.pendown()
color("darkorange" , "yellow")
begin_fill()
turtle.circle(60)
end_fill()

#tegn sol streger
n_solstråler=random.randint(15,25)
for i in range(n_solstråler):
    turtle.penup()
    turtle.right(90)
    turtle.forward(10)
    turtle.pendown()
    turtle.color("yellow")
    turtle.pensize(5)
    turtle.forward(50)
    turtle.penup()
    turtle.backward(60)
    turtle.left(90)
    turtle.circle(60,360/n_solstråler)


turtle.color("blue")

#tegn bjerg
turtle.pensize(1)
turtle.penup()
turtle.color("brown")
turtle.left(90)
turtle.forward(330)
turtle.left(90)
turtle.forward(850)
color("black","brown")
begin_fill()
turtle.pendown()
turtle.left(45)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.backward(50)
turtle.left(90)
turtle.forward(130)
turtle.right(90)
turtle.forward(180)
turtle.right(135)
turtle.forward(325)
end_fill()

#Tegn sne lille bjerg
turtle.penup()
turtle.right(135)
turtle.forward(80)
turtle.right(90)
turtle.pendown()
color("white")
begin_fill()
turtle.circle(20, 91)
turtle.penup()
turtle.left(90)
turtle.forward(20)
turtle.left(90)
turtle.forward(20)
end_fill()

#Tegn sne store bjerg
turtle.penup()
turtle.right(180)
turtle.forward(20)
turtle.right(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(100)
turtle.right(90)
turtle.pendown()
color("white")
begin_fill()
turtle.circle(30 , 91)
turtle.penup()
turtle.left(90)
turtle.forward(30)
turtle.left(90)
turtle.forward(30)
end_fill()

turtle.hideturtle()

Nicky Margaard Lund[edit]

Oscar Samsø Sørensen[edit]

http://rtgkom.dk/~oscarss15/turtle_blomst_rigtig_lille.PNG

import turtle
from turtle import *

turtle.screensize(600, 600, "lightblue")

turtle.speed(0)
turtle.ht()

#Bagrund græs
begin_fill()
turtle.color("dark green")
turtle.forward(700)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(1400)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(700)
end_fill()


turtle.home()
#Tegn stilk orange
turtle.color("green")
turtle.pensize(5)
turtle.right(90)
turtle.forward(150)
turtle.backward(150)
turtle.pensize(1)

#Definer bladene
def kroneblad(radius) :
    turtle.circle(radius, steps=7)

#Tegn blomst orange
n_blade = 7
color("red", "orange")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(1)
        turtle.left(360/n_blade)
        kroneblad(20)

blomst()
end_fill()

turtle.home()
penup()
turtle.forward(100)
pendown()

#Tegn stilk blå
turtle.color("green")
turtle.pensize(5)
turtle.right(90)
turtle.forward(150)
turtle.backward(150)
turtle.pensize(1)

#Tegn blomst blå
n_blade = 4
color("yellow", "dark blue")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(1)
        turtle.left(360/n_blade)
        kroneblad(20)
blomst()
end_fill()

#Tegn sol
penup()
turtle.home()
turtle.left(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(300)
pendown()
begin_fill()
color("yellow")
turtle.circle(70)
end_fill()

Piet Emil Skovgaard Gravesen[edit]

Billede af blomst


https://preview.ibb.co/fo0DdG/Screen_Shot_2017_11_01_at_11_55_39.png

import turtle

#baggrund med andet
turtle.screensize(1000, 1000)
turtle.hideturtle()
turtle.tracer(False)
turtle.bgcolor("#58ACFA")


#regnbue
turtle.penup()
turtle.left(90)
turtle.forward(300)
turtle.left(90)
turtle.pendown()

turtle.begin_fill()
turtle.fillcolor("light green")
turtle.circle(300)
turtle.end_fill()

turtle.penup()
turtle.begin_fill()
turtle.left(90)
turtle.forward(20)
turtle.right(90)
turtle.pendown()
turtle.fillcolor("#2E64FE")
turtle.circle(280)
turtle.end_fill()

turtle.penup()
turtle.begin_fill()
turtle.left(90)
turtle.forward(20)
turtle.right(90)
turtle.fillcolor("#FFFF00")
turtle.pendown()
turtle.circle(260)
turtle.end_fill()

turtle.penup()
turtle.begin_fill()
turtle.left(90)
turtle.forward(20)
turtle.right(90)
turtle.fillcolor("#FF0040")
turtle.pendown()
turtle.circle(240)
turtle.end_fill()

turtle.penup()
turtle.begin_fill()
turtle.left(90)
turtle.forward(20)
turtle.right(90)
turtle.fillcolor("#58ACFA")
turtle.pendown()
turtle.circle(220)
turtle.end_fill()


#græs
turtle.penup()
turtle.home()
turtle.right(90)
turtle.forward(250)
turtle.left(90)
turtle.forward(500)
turtle.right(180)
turtle.pendown()
turtle.pensize(500)
turtle.pencolor("green")
turtle.forward(1000)
turtle.penup()




#miderste blomst
turtle.home()
turtle.pencolor("green")
turtle.pendown()
turtle.pensize(5)
turtle.left(90)
turtle.forward(200)
turtle.pensize(1)


def petal(radius,steps):
    turtle.pencolor("#808000")
    turtle.begin_fill()
    turtle.fillcolor("yellow")
    turtle.circle(radius,90,form)
    turtle.left(90)
    turtle.circle(radius,90,form)
    turtle.end_fill()


blade = 8
form = 8
radius = 50

for i in range(blade):
    turtle.setheading(0)
    turtle.right(360*i/blade)
    petal(radius,form)

#midten af blomsten
turtle.penup()
turtle.home()
turtle.left(90)
turtle.forward(200)
turtle.right(180)
turtle.forward(10)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("black")
turtle.left(90)
turtle.circle(10)
turtle.end_fill()



#højre blomst
turtle.penup()
turtle.home()
turtle.forward(250)
turtle.pendown()
turtle.pencolor("green")
turtle.pensize(5)
turtle.left(90)
turtle.forward(200)
turtle.pensize(1)


def petal(radius,steps):
    turtle.pencolor("#808000")
    turtle.begin_fill()
    turtle.fillcolor("yellow")
    turtle.circle(radius,90,form)
    turtle.left(90)
    turtle.circle(radius,90,form)
    turtle.end_fill()

blade = 8
form = 8
radius = 50

for i in range(blade):
    turtle.setheading(0)
    turtle.right(360*i/blade)
    petal(radius,form)

#midten af blomsten
turtle.penup()
turtle.home()
turtle.forward(250)
turtle.left(90)
turtle.forward(200)
turtle.right(180)
turtle.forward(10)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("black")
turtle.left(90)
turtle.circle(10)
turtle.end_fill()

turtle.tracer(True)
turtle.done()





Rasmus Bo Dybdahl[edit]

Turtle billede[edit]

Her er et billede af mit slutresultat. Græsset, bjergene, blomsten og solens placering er genereret tilfældigt. http://rtgkom.dk/~rasmusbd15/programmering/programmering_billede_småt.PNG

Kildekode[edit]

import turtle
from turtle import *
from random import randint

turtle.screensize(600, 600, "#3797CE")

turtle.speed(0)

#Tegn sol
turtle.penup()
turtle.forward(350)
turtle.right(90)
turtle.backward(randint(40,80))
turtle.pendown()
color("#FDB813")
begin_fill()
turtle.circle(100)
end_fill()



#Tegn solstråler
n_solstråler = 60
for i in range(n_solstråler):
    turtle.speed(0)
    turtle.penup()
    turtle.right(90)
    turtle.forward(0)
    turtle.pendown()
    turtle.color("#FFCC00")
    turtle.pensize(10)
    turtle.forward(1100)
    turtle.penup()
    turtle.backward(1100)
    turtle.left(90)
    turtle.circle(100,360/n_solstråler)

#Gå tilbage til 0,0
turtle.penup()
turtle.home()
turtle.pendown()

#Tilfældige bjerge
n_bjerge = 10
turtle.color("grey", "#968D99")
turtle.pensize(2)
begin_fill()
turtle.right(180)
turtle.forward(700)
turtle.right(135)

for i in range(n_bjerge):
    bjerg_højde = randint(80,200)
    turtle.forward(bjerg_højde)
    bjerg_vinkel = randint(70,140)
    turtle.right(bjerg_vinkel)
    turtle.forward(bjerg_højde)
    turtle.backward(randint(30,60))
    turtle.left(bjerg_vinkel-1)
    
turtle.right(bjerg_vinkel)
turtle.forward(1000)
turtle.home()
end_fill()

#Tegn landskab
color("darkgreen","#007B0C")
turtle.pensize(2)
begin_fill()
turtle.forward(1000)
turtle.right(90)
turtle.forward(1000)
turtle.right(90)
turtle.forward(2000)
turtle.right(90)
turtle.forward(1000)
turtle.right(90)
turtle.forward(1000)
end_fill()


#Tegn tilfædigt græs
n_gras = 200
for i in range(n_gras):
    turtle.penup()
    turtle.home()
    turtle.color("#01A611")
    turtle.pensize(randint(3,5))
    turtle.lt(90)
    x = randint(-800, 800)
    y = randint(-400, 0)
    turtle.setpos(x, y)
    turtle.pendown()
    gras_størrelse = randint(5,13)
    turtle.forward(gras_størrelse)
turtle.penup()
turtle.home()
turtle.pendown()

#Tegn stilken
turtle.color("darkgreen")
turtle.pensize(10)
turtle.right(90)
turtle.forward(150)
turtle.backward(150)
turtle.pensize(2)


#Definer bladene
def kroneblad(radius):
    turtle.circle(radius, steps=6)

#Tegn rosen
n_blade = randint(5,10)
color("darkred", "#cb0e40")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(10)
        turtle.left(360./n_blade)
        kroneblad(40)
        
blomst()
end_fill()

Sebastian Samsø Sørensen[edit]

http://www.rtgkom.dk/~sebastianss15/python_turtle_billede_lille.PNG

import turtle
from turtle import *

turtle.screensize(1000, 1000, "blue")
turtle.speed(0)

#Tegn bjerg
penup()
turtle.home()

pendown()
begin_fill()
turtle.color("black", "grey")
turtle.left(180)
turtle.forward(670)
turtle.right(120)
turtle.forward(200)
turtle.right(100)
turtle.forward(170)
turtle.left(180)
turtle.forward(40)
turtle.right(90)
turtle.forward(180)
turtle.right(90)
turtle.forward(200)
turtle.right(90)
turtle.forward(50)
turtle.right(180)
turtle.forward(180)
end_fill()

penup()
turtle.home()

pendown()
#Baggrundsgræs
begin_fill()
turtle.color("green")
turtle.forward(1100)
turtle.right(90)
turtle.forward(500)
turtle.right(90)
turtle.forward(2200)
turtle.right(90)
turtle.forward(500)
end_fill()

turtle.home()
#Tegn stilk gul blomst
turtle.color("darkgreen")
turtle.pensize(5)
turtle.right(90)
turtle.forward(200)
turtle.backward(200)
turtle.pensize(1)

turtle.home()
#Definer bladene
def kronblad(radius) :
    turtle.circle(radius, steps=6)

#Tegn blomst gul
n_blade = 6
color("red", "yellow")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(1)
        turtle.left(360/n_blade)
        kronblad(20)

blomst()
end_fill()

penup()
turtle.forward(300)
turtle.right(90)
turtle.forward(150)
turtle.left(90)

pendown()
#Tegn stilk rød blomst
turtle.color("darkgreen")
turtle.pensize(5)
turtle.right(90)
turtle.forward(200)
turtle.backward(200)
turtle.pensize(1)

#Tegn blomst rød
n_blade = 6
color("yellow", "red")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(1)
        turtle.left(360/n_blade)
        kronblad(20)

blomst()
end_fill()

penup()
turtle.home()
turtle.left(180)
turtle.forward(300)
turtle.left(90)
turtle.forward(150)
turtle.left(90)

pendown()
#Tegn stilk blå blomst
turtle.color("darkgreen")
turtle.pensize(5)
turtle.right(90)
turtle.forward(200)
turtle.backward(200)
turtle.pensize(1)

#Tegn blomst blå
n_blade = 6
color("yellow", "blue")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(1)
        turtle.left(360/n_blade)
        kronblad(20)

blomst()
end_fill()

penup()
turtle.home()

#Tegn sol
turtle.forward(500)
turtle.left(90)
turtle.forward(200)

pendown()
color("yellow")
begin_fill()
turtle.circle(90,steps=4)
end_fill()

begin_fill()
turtle.left(90)
turtle.forward(19)
turtle.right(90)
turtle.circle(72)
end_fill()

Thomas Alexander Mike Collin Nissen[edit]

Her er min lille hyggelige blomst http://rtgkom.dk/~thomasamcn15/rsz_flotte_blomst.png

import turtle
from turtle import *
turtle.tracer(False)

turtle.screensize(1000, 1000, "#58ACFA")


begin_fill()
turtle.color("green")
turtle.forward(1100)
turtle.right(90)
turtle.forward(500)
turtle.right(90)
turtle.forward(2200)
turtle.right(90)
turtle.forward(500)
end_fill()

turtle.home()

turtle.color("darkgreen")
turtle.pensize(5)
turtle.right(90)
turtle.forward(200)
turtle.backward(200)
turtle.pensize(1)

turtle.home()

def kronblad(radius) :
    turtle.circle(radius, steps=150)


n_blade = 6
color("#808000", "red")
begin_fill()
def blomst():
    for i in range(n_blade):
        turtle.forward(2)
        turtle.left(360/n_blade)
        kronblad(20)
        
blomst()
end_fill()
  

Villiam Holmbach List[edit]

Blomst

http://www.rtgkom.dk/~villiamhl14/blomst/BlomstRe.png


Kildekode


								#- Made by Villiam List-#
						#-Turtle Import, Speed and Window Management-#
import turtle
wn = turtle.Screen()
wn.bgcolor("blue") #Backgroundcolor - skycolor
wn.title("Blomst - Villiam List") #WindowTitle
turtle.speed(0) #Turtle speed
turtle.screensize(800,800) #Screensize

#-Shortcuts-#
#pu = penup
#pd = pendown
#fd = forward
#bk = backward
#lt = left
#rt = right

def background(): #-Background-#
	turtle.pu() 
	turtle.lt(90) 
	turtle.fd(100) 
	turtle.lt(90)
	turtle.fd(500)
	turtle.begin_fill()
	turtle.fillcolor("green")
	turtle.pd()
	for i in range(4): #Repeat four times
			turtle.lt(90)
			turtle.fd(1000)
	turtle.end_fill()
background()

def Stilk():			#-Definition and Creation of "Stilk"-#
	turtle.pu()
	turtle.home()
	turtle.pd()
	turtle.color("black")
	turtle.begin_fill()
	turtle.fillcolor("yellow")
	for i in range(2): #Repeat twice
		turtle.fd(10)
		turtle.rt(90)
		turtle.fd(300)
		turtle.rt(90)
		turtle.fd(10)
	turtle.end_fill()
Stilk()	

	

def Kronblade(Amount):		#-Definition and Creation of "Kronblade"-#
	for i in range(Amount): #Repeat 25 times
		turtle.color("yellow") #Turtle color
		turtle.shape("circle") #Turtle shape
		turtle.shapesize(15,0.5,1) #Turtle shape size (width, length, outline)
		turtle.fillcolor("red") #Turtle color
		turtle.stamp() #Stamp turtle at current position
		turtle.rt(360/Amount)
Kronblade(25) #-Amount-"

def Frugtanlæg():		#-Definition and Creation of "Frugtanlæg"-#
	turtle.shape("circle")
	turtle.shapesize(2,2,2)
	turtle.color("black")
	turtle.fillcolor("yellow")
	turtle.stamp()
	turtle.shape("arrow")
	turtle.shapesize(0.5,0.5,0.5)
Frugtanlæg()

def GoToSol():			#-Navigate to "Sol" Location-#
	turtle.pu()
	turtle.fd(250)
	turtle.lt(90)
	turtle.fd(250)
GoToSol()	

def Sol():				#-Definition and Creation of "Sol"-#
	turtle.pd()
	turtle.begin_fill()
	turtle.fillcolor("yellow")
	turtle.circle(30)
	turtle.end_fill()
	turtle.lt(90)
	turtle.pu()
	turtle.fd(30)
	turtle.rt(90)
Sol()

def Solstråler():		#-Definition and Creation of "Solstråler"-#
	for i in range(12):
		turtle.pu()
		turtle.fd(50)
		turtle.lt(90)
		turtle.begin_fill()
		turtle.fillcolor("yellow")
		for i in range(2):
			turtle.pd()
			turtle.fd(2)
			turtle.rt(90)
			turtle.fd(40)
			turtle.rt(90)
			turtle.fd(2)
		turtle.end_fill()
		turtle.rt(90)
		turtle.pu()
		turtle.bk(50)
		turtle.rt(360/12)
Solstråler()

def Fjeld(): #-Definition and creation of Fjeld#
	
	turtle.bk(150) #-Navigate to "Fjeld" location-#
	turtle.lt(90)
	turtle.fd(350)
	turtle.pd()
	
	FjeldPos = turtle.pos() #Save current coordinates as "FjeldPos"
	turtle.begin_fill()
	turtle.fillcolor("brown")
	turtle.fd(300)
	turtle.rt(110)
	turtle.fd(150)
	turtle.rt(110)
	turtle.fd(50)
	turtle.lt(100)
	turtle.fd(80)
	turtle.rt(100)
	turtle.fd(60)
	turtle.lt(100)
	turtle.fd(40)
	turtle.rt(110)
	turtle.fd(90)
	turtle.lt(90)
	turtle.fd(20)
	turtle.setpos(FjeldPos) #Move to saved coordinate "FjeldPos"
	turtle.end_fill()
Fjeld()

wn.exitonclick()		#-Wait for user to click window before closing-#