當前位置:成語大全網 - 新華字典 - python調用畫布總是出現'dict' object has no attribute 'forward'

python調用畫布總是出現'dict' object has no attribute 'forward'

turtle.pen() 返回的是壹個字典。

>>>?t?=?turtle.pen()

>>>?t

{'pensize':?1,?'shown':?True,?'resizemode':?'noresize',?'fillcolor':?'black',?'stretchfactor':?(1,?1),?'tilt':?0,?'speed':?3,?'pendown':?True,?'pencolor':?'black',?'outline':?1}

>>>

妳的想法應該是使用turtle.forward(60)吧

>>>?print?turtle.forward.__doc__

Move?the?turtle?forward?by?the?specified?distance.

Aliases:?forward?|?fd

Argument:

distance?--?a?number?(integer?or?float)

Move?the?turtle?forward?by?the?specified?distance,?in?the?direction

the?turtle?is?headed.

Example:

>>>?position()

(0.00,?0.00)

>>>?forward(25)

>>>?position()

(25.00,0.00)

>>>?forward(-75)

>>>?position()

(-50.00,0.00)

>>>