[Tutor] how to write a turtle.py program
Gregor Lingl
glingl@aon.at
Tue Feb 11 18:05:19 2003
Michael Janssen schrieb:
>>to keep it open keep the python programm open. Best way is to use -i
>>Parameter:
>>python -i turtle.py
>>
>>
>
>Correction: python -i name_of_your_script.py ....
>
>Michael
>
>
>>---> python executes the script and go into interactive mode. sys.exit()
>>or ctrl-C terminates.
>>
>>
>>>#!/usr/bin/python
>>>import turtle
>>>turtle.reset()
>>>turtle.forward(100)
>>>
>>>
Other ways to accomplish this are:
(1) The standard Tkinter - way:
add the statement
turtle.Tkinter.mainloop()
as last line of you script.
Closing the turtle-Window then terminates the program
(2) If the script doesn't expect to handle events (mouse clicks etc...)
you may add a simple
raw_input()
as last statement of your script. Hitting Enter at the MSDOS-shell window
(or xterm?) will terminate your program.
Regards, Gregor
>>>thanks
>>>re-v
>>>
>>>
>>>
>>>
>>>_______________________________________________
>>>Tutor maillist - Tutor@python.org
>>>http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
>>>
>>_______________________________________________
>>Tutor maillist - Tutor@python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
>>
>>
>
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
>