Crtanje u Pythonu
1. Dovrši koordinatni sustav (nacrtaj koordinatne osi)
from turtle import*
title ('Koordinatni')
def koordinatni(x,y,kut1,kut2):
setpos (0,0)
setpos (x,y)
lt (kut1)
fd(20)
setpos(x,y)
lt(kut2)
fd(20)
pu()
home()
pd()
koordinatni (250, 0, 135, 90)
koordinatni (0, 250, 225, 90)
koordinatni(-250,0,45,270)
koordinatni (0, -250, 45, 90)
2. Napravi oznake za jedinice
from turtle import*title ('Koordinatni')
def koordinatni(x,y,kut1,kut2):
setpos (0,0)
setpos (x,y)
lt (kut1)
fd(20)
setpos(x,y)
lt(kut2)
fd(20)
pu()
home()
pd()
def crtica (x, y):
pu()
setpos(x, y)
pd()
fd(10)
koordinatni (250, 0, 135, 90)
koordinatni (0, 250, 225, 90)
koordinatni(-250,0,45,270)
koordinatni (0, -250, 45, 90)
lt(90)
for i in range (24):
crtica(i*10, -5)
for i in range (24):
crtica(i*(-10), -5)
pu()
home()
for i in range (24):
crtica(-5, i*(10))
for i in range (24):
crtica(-5, i*(-10))