简体   繁体   English

Python乌龟模块中乌龟的默认值

[英]Defaults of the turtle in Python turtle module

For teaching purposes I need a list of the graphics defaults. 出于教学目的,我需要图形默认列表。 Here's what I have by now: 这是我现在拥有的:

background  white
canvas      950W by 800H
dot         5 (pixels)
fill color  black
heading     0 (East)
home        (0,0) (screen center)
pen color   black
shape       classic (arrow)
speed       3 (of turtle)
width       1 (of line)

Are there any more defaults? 还有更多默认设置吗? Thank you 谢谢

The turtle.pen() method (often confused with the turtle.Pen() method) allows you to query and set a number of attributes, initially showing their defaults: turtle.pen()方法(通常与turtle.Pen()方法混淆)允许您查询和设置许多属性,最初显示其默认值:

>>> turtle.pen()
{'shown': True, 'pendown': True, 'pencolor': 'black', 'fillcolor': 'black', 'pensize': 1, 
'speed': 3, 'resizemode': 'noresize', 'stretchfactor': (1.0, 1.0),
'shearfactor': 0.0, 'outline': 1, 'tilt': 0.0}
>>> 

Where ' shown ' is an alternate term for ' visible '. 其中“ 显示 ”是“ 可见 ”的替代术语。 Other defaults: 其他默认值:

mode: 'standard'  # default for turtle.mode()
colormode: 1.0  # default for turtle.colormode()
angle units: degrees  # change with turtle.radians()

The first two are likely screen defaults but the last is set on a per turtle basis. 前两个可能是屏幕默认设置,但最后一个是根据每个乌龟设置的。 I believe that this is incorrect: 我认为这是不正确的:

canvas      950W by 800H

The default turtle screen size is 50% of your screen width and 75% of your screen height. 默认的乌龟屏幕尺寸为屏幕宽度的50%和屏幕高度的75%。 The screen setup routine will accept fractions as well as pixels: 屏幕设置例程将接受分数和像素:

turtle.Screen().setup(0.25, 0.25)

Canvas is the only default that is not correct. 画布是唯一不正确的默认设置。 I believe that 'default' will depend on the environment you are using. 我相信“默认”将取决于您使用的环境。 For example, in trinket, the default is -200 to +200 in both the x and the y directions. 例如,在饰品中,x和y方向的默认值为-200到+200。

The student's I teach are complete beginners and I just stick to the ones you listed I find for most of the students that is enough. 我所教的学生是完全的初学者,我只是坚持我列出的对大多数学生来说足够的列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM