Python Turtle, draw text with on screen with larger font

后端 未结 3 2040
忘掉有多难
忘掉有多难 2021-01-04 04:47

I\'m using python turtle\'s write method to write text on the screen like this:

turtle.write(\"messi fan\")

The size of the font is too sma

3条回答
  •  余生分开走
    2021-01-04 05:10

    Use the optional font argument to turtle.write(), from the docs:

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

    • arg – object to be written to the TurtleScreen
    • move – True/False
    • align – one of the strings “left”, “center” or right”
    • font – a triple (fontname, fontsize, fonttype)

    So you could do something like turtle.write("messi fan", font=("Arial", 16, "normal")) to change the font size to 16 (default is 8).

提交回复
热议问题