I wrote this code:
import turtle
wn = turtle.Screen()
Matthew = turtle.Turtle()
Matthew.forward(200)
Matthew.left(90)
Matthew.forward(200)
and saved it as Matthew.py If I run Matthew.py using Idle I get the expected behaviour (new window opens and little turtle does its moves). If I open and run Matthew.py in Canopy it just hangs there. All I see is:
%run /Users/matteoniccoli/Canopy/Notebooks/Matthew.py
but it just hangs there, no errors.
Am I doing something wrong?
Please notice as an experiment I copied the same code in a IPython notebook and saved it as Matthew.ipynb, then run the code in the notebook in Canopy and it works fine.
By default Canopy Python uses a Qt GUI backend. Turtle uses a TK backend. They conflict. See https://support.enthought.com/entries/21793229-Using-Tkinter-Turtle-in-Canopy-s-IPython-panel for resolution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.