0
import turtle

fondo = turtle.Screen()

fondo.setup(width=500, height=500, startx=750, starty=300)

fondo.bgcolor("blue")

There's no TypeError or NameError in my project, so it's rare that this is happening. I'm using Pycharm for this project. Thank you

Rabinzel
  • 7,757
  • 3
  • 10
  • 30
tobias
  • 25
  • 4
  • 1
    What "graphic" were you expecting to appear? All this code should do is create a blank blue screen. – jasonharper Jul 18 '22 at 15:31
  • yes, but doesn't appear, any suggestions? – tobias Jul 18 '22 at 22:24
  • Does [Python Turtle Graphics Window only Opens Briefly then Closes](https://stackoverflow.com/questions/19018243/python-turtle-graphics-window-only-opens-briefly-then-closes) answer your question? – ggorlen Jul 19 '22 at 16:40

2 Answers2

1

it work fine for me I run the script on my phone and it executed with no error. Could you check if you have installed a python compiler, cuz pycharm is just an ide.

You need compiler to run high level programming languages eg python, c++, java but you can run assembly on any device, c programming languages can run on windows also.

Abdiqani
  • 11
  • 2
0

It probably does appear, but very quickly closes again. You didn't transfer control to the event handler so the program started and then immediately quit. Add a mainloop() at the end to transfer control:

import turtle

fondo = turtle.Screen()

fondo.setup(width=500, height=500, startx=750, starty=300)

fondo.bgcolor("blue")

# the rest of your code goes here

fondo.mainloop()

This is true for standard Python/turtle, under PyCharm, things might work differently.

cdlane
  • 40,441
  • 5
  • 32
  • 81