This media is not supported in your browser
VIEW IN TELEGRAM
#turtle
Python-da toshbaqa (turtle grafic) yordamida yurak hosil qilish.
Turtle - bu Python-da ichki modul.
🐍 Python Dasturlash Maktabi
Python-da toshbaqa (turtle grafic) yordamida yurak hosil qilish.
Turtle - bu Python-da ichki modul.
import turtle
qalam = turtle.Turtle()
def egri_chiziq():
for i in range(200):
qalam.right(1)
qalam.forward(1)
def yurak():
qalam.fillcolor('red')
qalam.begin_fill()
qalam.left(140)
qalam.forward(113)
egri_chiziq()
qalam.left(120)
egri_chiziq()
qalam.forward(112)
qalam.end_fill()
def txt():
qalam.up()
qalam.setpos(-68, 95)
qalam.down()
qalam.color('lightgreen')
qalam.write("Uz Python Dasturlash", font=(
"Verdana", 12, "bold"))
yurak()
txt()
qalam.ht()
🐍 Python Dasturlash Maktabi
This media is not supported in your browser
VIEW IN TELEGRAM
#Spinner #Turtle #Simpleproject
# @uz_python 🦖
from turtle import *
state = {'turn': 0}
def spinner():
"Spinnerni chizish."
clear()
angle = state['turn'] / 10
right(angle)
forward(100)
dot(120, 'red')
back(100)
right(120)
forward(100)
dot(120, 'green')
back(100)
right(120)
forward(100)
dot(120, 'blue')
back(100)
right(120)
update()
def animate():
"Spinner animatsiyasini yaratish"
if state['turn'] > 0:
state['turn'] -= 1
spinner()
ontimer(animate, 20)
def flick():
"Spinnerni aylantirish"
state['turn'] += 10
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
width(20)
onkey(flick, 'space') #space tugmasini tez tez bosing va spinnerni aylantiring
listen()
animate()
done()
# @uz_python 🦖