簡體   English   中英

在Turtle Python中繪制“ DBGS”

[英]Draw “DBGS” in Turtle Python

我在嘗試用Turtle python編碼時遇到了麻煩。 我在繪制字母“ D”時需要幫助。 但是我的真正目的是繪制字母“ DBGS”。 指我的學校縮寫。 請幫忙

如果要實際繪制它們,請參閱此問題以獲取一些提示和建議。 否則,turtle具有文本的內置方法turtle.write() 以下是參數:

turtle.write(*arg*, *move=False*, *align="left"*, *font=("Arial", 8, "normal")*)
參數:

  • arg –要寫入TurtleScreen的對象
  • 移動 –正確/錯誤
  • align –字符串“ left”,“ center”或“ right”之一
  • 字體 –三元組(字體名稱,字體大小,字體類型)

例如:

turtle.write('DBGS', #the text
             True, #move the mouse to the bottom left corner of the text
             'center', #align the text to centre
             ('Arial', 10, 'bold')) #'Arial' font, size 10, bold

繪制“ D”的簡單方法是使用半圓:

from turtle import *
circle(100, 180) #180 degrees of a circle radius 100
left(90)
forward(200)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM