Python Turtle,在屏幕上用更大的字体绘制文本 [英] Python Turtle, draw text with on screen with larger font

查看:164
本文介绍了Python Turtle,在屏幕上用更大的字体绘制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 python turtle 的 write 方法在屏幕上写文本,如下所示:

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 small. How can I increase the size of font?

推荐答案

使用可选的 font 参数 turtle.write(),来自文档:

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

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

  • arg – 要写入 TurtleScreen 的对象
  • 移动 – 真/假
  • align – 字符串左"、中心"或右"之一
  • font – 三元组(字体名称、字体大小、字体类型)
  • 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)

所以你可以像 turtle.write("messi fan", font=("Arial", 16, "normal")) 将字体大小更改为 16(默认为 8).

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

这篇关于Python Turtle,在屏幕上用更大的字体绘制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆