turtle.pendown()
turtle.circle(45)
turtle.color("yellow")
turtle.penup()
turtle.goto(-55, -75)
turtle.pendown()
turtle.circle(45)
turtle.color("green")
turtle.penup()
turtle.goto(55, -75)
turtle.pendown()
turtle.circle(45)
turtle.color("black")
turtle.penup()
91
turtle.goto(0, 80)
turtle.pendown()
turtle.write("Olympic Symbol") # Вместоещеодногокругавыводимнадпись "Olympic Symbol"
turtle.done()
uychani chizaylik juda zo’r bo’lmasada harakat qilamiz :) ):
Bu yerda yana bir nechta funktsiyalar mavjud:
import turtle
turtle.penup()
turtle.goto(35, 35)
turtle.right(90) # o’nga 0 gradusa kursorni buramiz
turtle.pendown()
turtle.forward(70) # oldinga 70 masofani o’tamiz agarda kursor tushirilan bo’lsa, yurish izidan chiziq chizilgan bo’ladi
turtle.right(90)
turtle.forward(70)
turtle.right(90)
92
Pythonda konsolda rasm chizamiz:
Rasmlarni konsolda chizish uchun quyidagi asciimatics (galereyani) qo’llash mumkin:
Bu ASCII simvollardan rasmlarni yaratadi. Unda ranglar, kursor joylashuvi va boshqalar bilan terminal imkoniyatlarini qo’llaydi. Linuxda framebuffer e.g. fbi ni qo’llab rasmlarni ko’rsatish mumkin
from colorama import init, Fore, Back, Style init()
93
def console_picture():
print(Style.BRIGHT + Fore.YELLOW)
print(" ** ** ******** ** ** ** ") print(" ** ** ******** ** ** ** ** ") print(" ******** ** ** ** ** ** ") print(" ******** ******** ** ** ** ** ") print(" ** ** ** ** ** ** ** ")
print(" ** ** ******** ******** ******** ** ** ") print(" ** ** ******** ******** ******** ** ")
console_picture() input()
from colorama import init, Fore, Back, Style init()
defconsole_picture():
print(Style.BRIGHT + Fore.YELLOW)
print(" ** ** ******** ** ** ** ") print(" ** ** ******** ** ** ** ** ") print(" ******** ** ** ** ** ** ") print(" ******** ******** ** ** ** ** ") print(" ** ** ** ** ** ** ** ")
print(" ** ** ******** ******** ******** ** ** ") print(" ** ** ******** ******** ******** ** ")
console_picture() input()
94
Do'stlaringiz bilan baham: |