Oliy va o’rta mahsus ta’lim vazirligi namangan davlat universiteti gulshod yunusova


turtle.pendown() turtle.circle(45) turtle.color("yellow")


Download 5.84 Mb.
bet23/40
Sana15.09.2023
Hajmi5.84 Mb.
#1678635
1   ...   19   20   21   22   23   24   25   26   ...   40
Bog'liq
python 1 qism дарслик Г.Юнусова (1)

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

Download 5.84 Mb.

Do'stlaringiz bilan baham:
1   ...   19   20   21   22   23   24   25   26   ...   40




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling