Python 3.0 using turtle.onclick

前端 未结 6 1735
梦毁少年i
梦毁少年i 2020-12-04 03:51

So here is my problem, I have to make a picture for my CS class and it is really frustrating estimating in turtle. I planed to use .onclick() to show me to position.

6条回答
  •  遥遥无期
    2020-12-04 04:03

    Awesome job figuring out a solution on your own.

    Did you ever look through the docs for turtle?

    http://docs.python.org/2/library/turtle.html

    Looks like you can import screen as well as turtle from the module. screen has an onclick event of its own that does what you expect it to.

    Note the following line on how to get access to the screen object:

    The function Screen() returns a singleton object of a TurtleScreen subclass.
    This function should be used when turtle is used as a standalone tool for
    doing graphics. As a singleton object, inheriting from its class is not
    possible.
    

    Disclaimer: I've never used turtle before.

提交回复
热议问题