I use eclipse IDE and pydev plugins for python development. In eclipse when I run the following code snippet the program output window appears and disappears immediately. How to solve this when using ecliple (not using by terminal or command prompt)?
import turtle
wn = turtle.Screen()
alex = turtle.Turtle()
alex.forward(50)
alex.left(90)
alex.forward(30)
wn.mainloop()
That is because you get an error, it has nothing to do with eclipse:
AttributeError: '_Screen' object has no attribute 'mainloop'
If you want a continuous loop use a while loop or a for loop:
import turtle
while True:
wn = turtle.Screen()
alex = turtle.Turtle()
alex.forward(50)
alex.left(90)
alex.forward(30)
If you want to just see the keep the screen up use exitonclick()
wn.exitonclick()
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments