Really dumb question!

Mike Silva snarflemike at yahoo.com
Wed Feb 26 16:44:34 EST 2003


"Steve Holden" <sholden at holdenweb.com> wrote in message news:<9z27a.106958$zL6.194 at news2.central.cox.net>...
> "Manuel M. Garcia" <mail at manuelmgarcia.com> wrote in message
> news:idko5v8cbekoj0r367ulkdf32nu15tvj42 at 4ax.com...
> > On 25 Feb 2003 14:37:58 -0800, snarflemike at yahoo.com (Mike Silva)
> > wrote:
> >
> > >So, my son and I are playing around with Python, esp. the turtle
> > >module, and we can't figure out a way to stop the program!  Ctrl-C (in
> > >any window) doesn't do it, and closing the Tk graphics window doesn't
> > >do it (just opens up again and continues drawing).  This gets to be a
> > >problem when he decides to draw 10 lines and types in 100 by mistake!
> > >
> > >So, my really dumb question is -- how do we kill an executing program,
> > >in particular one doing (turtle) graphics?!
> > >
> > >Mike
> >
> > Are you using Windows?  ActivePython?  I have some versions of Windows
> > to play with at work.  If you tell me your version of Windows and
> > Python, I can send you an email to walk you through it.
> >
> > In general, Python running in Windows is not responsive to Ctrl-C.
> > The way to stop the program is to close the parent window.  (The
> > parent window might be Command Prompt, or PythonWin, or its own text
> > window)  If you run your scripts by double-clicking on an icon, use
> > the .py extension instead of the .pyw extension, and the parent window
> > will always be visible.
> >
> 
> 
> Manuel:
> 
> Try using CTRL/Break in Windows, that will usually break into a
> console-based program even when CTRL/C isn't regarded as urgent enough.
> 
> I suspect that Mike's problem is more that he's writing graphics output into
> a Tkinter window from a console-based program, and he wants some way to
> indicate to the program that it should stop what it's doing before it's
> finished, and wait for further input from the user. Right, Mike?
> 
> regards

Well, here's an example of a program that I can't stop (tried Ctrl-C,
Ctrl-D, Ctrl-Break, closing the main window, etc, etc):

# File: test.py

from turtle import *

reset()

length = 50
inc = 3
loops = 20
sides = 4
hue = 0.0

width( 3 )

for i in range( 1, loops + 1 ):

    for j in range( 0, sides ):
        color( hue, hue * 3.0 % 1.0, 1.0 - hue )
        length += inc
        forward( length )
        right( 360 / sides )
        hue += 1.0/(loops * sides)


Mike




More information about the Python-list mailing list