omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Turtle turtle.Screen() not working

    Pythonista
    5
    13
    5142
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • oDuty
      oDuty last edited by ccc

      I am on my ipad and i just bought pythonista. I wanted to create something in turtle but i kept on getting the error: module ‘turtle’ has no attribute ‘Screen’
      The code:

      import turtle as t
      playerAscore=0
      playerBscore=0
      
      window = t.Screen()
      window.title("pong ping")
      window.bgcolor("black")
      window.setup(width=800,height=600)
      window.tracer(0)
      

      I am aware this turtle module is possibly old or unfinished but if there is anything i can do please let me know.a

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        Add

        window.present()
        
        1 Reply Last reply Reply Quote 0
        • oDuty
          oDuty last edited by

          Whereabouts should i add that?

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by

            At the end.

            1 Reply Last reply Reply Quote 0
            • oDuty
              oDuty last edited by

              Same error happens

              cvp 1 Reply Last reply Reply Quote 0
              • cvp
                cvp @oDuty last edited by

                @oDuty For me, that works. Sure you don't have another turtle.py somewhere?

                oDuty 1 Reply Last reply Reply Quote 1
                • JonB
                  JonB last edited by

                  As a check:

                  import turtle
                  print(turtle.__file__)
                  
                  1 Reply Last reply Reply Quote 1
                  • oDuty
                    oDuty @cvp last edited by

                    @cvp I’m new to this, what do you mean exactly?

                    cvp 1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @oDuty last edited by cvp

                      @oDuty Assume you have written a script named turtle.py, the import turtle you do would import your own script, not the standard one. That's why @JonB advices you to run his little script to see where resides the imported turtle. Try his little script and post the result.

                      1 Reply Last reply Reply Quote 0
                      • JonB
                        JonB last edited by

                        Add those two lines to the top of the script. Copy the result and paste here.

                        a common problem is that you created a file called turtle.py where you intended to try out the turtle module. But when you type import turtle, it imports your file, not the actual turtle module.

                        cvp 1 Reply Last reply Reply Quote 0
                        • cvp
                          cvp @JonB last edited by

                          @JonB sorry, didn't know you were there...

                          1 Reply Last reply Reply Quote 0
                          • Maz
                            Maz last edited by

                            so how do we fix the file turtle.py problem

                            JonB 1 Reply Last reply Reply Quote 0
                            • JonB
                              JonB @Maz last edited by

                              @Maz don't name your script turtle.py, unless you intend to replace the built in turtle module.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Powered by NodeBB Forums | Contributors