tobias
tobias

Reputation: 25

The graphic in my project using turtle library doesn't appear on my screen

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

Upvotes: 0

Views: 60

Answers (2)

Abdiqani
Abdiqani

Reputation: 11

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.

Upvotes: 1

cdlane
cdlane

Reputation: 41872

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.

Upvotes: 0

Related Questions