请教Python的turtle中stamp的作用意义是什么,可否举例,表示不明白,谢谢。

如题所述

    turtle.stamp()

    Stamp a copy of the turtle shape onto the canvas at the current turtle position. Return a stamp_id for that stamp, which can be used to delete it by calling clearstamp(stamp_id).

    >>> turtle.color("blue")>>> turtle.stamp()11>>> turtle.fd(50)

    turtle.clearstamp(stampid)

    Parameters:

    stampid – an integer, must be return value of previous stamp() call    

    Delete stamp with given stampid.

    >>> turtle.position()(150.00,-0.00)>>> turtle.color("blue")>>> astamp = turtle.stamp()>>> turtle.fd(50)>>> turtle.position()(200.00,-0.00)>>> turtle.clearstamp(astamp)>>> turtle.position()(200.00,-0.00)

    turtle.clearstamps(n=None)

温馨提示:内容为网友见解,仅供参考
第1个回答  2020-10-03
相当于Scratch的 画图工具里的 图章,就是盖戳,把乌龟盖上,取决于你的形状

但是他会返回一个stamp_id这样的一个值,记录你每个图章的先后顺序,这样在调用clearstamp(stamp_id)时,可以指定对应的值,删除对应的图章本回答被提问者采纳
相似回答