[Tutor] pausing and layout

mike O skitzomonkey@hotmail.com
Sat Jan 4 12:54:02 2003







>From: Michael Janssen <Janssen@rz.uni-frankfurt.de>
>To: mike O <skitzomonkey@hotmail.com>
>CC: <tutor@python.org>
>Subject: Re: [Tutor] pausing and layout
>Date: Sat, 4 Jan 2003 18:47:12 +0100 (CET)
>
>On Sat, 4 Jan 2003, mike O wrote:
>
> > I guess I have three questions, the first being: Is there a python 
>command
> > to pause until the user does something?
>Hello Mike
>
>In addition to Gonçalo's reply I want to say that raw_input() is typically
>used in a while loop:
>
>from types import IntType
>          ...
>
>     while 1:
>         p = raw_input("Choose a Number or [Q]uit: ")
>         if p == "Q" or p == "q" or p == "":
>             # User requests the end of the game
>             sys.exit()
>	elif type(p) == IntType:
>             # we have checked if p is sufficient and exit while loop
>             break
>         else:
>             # we've got some input, but it was the wrong: continue
>             # with the while loop and ask the user again
>             print "\tError: please choose a number."
>     #NOW do something with "p"
>
If you just wanted a number, couldn't you use input instead of raw_input? 
I'm not entirely sure on these two functions, other than that I thought 
input was for an integer, and raw_input was for a string, is that right?

>In a GUI application there is a overall loop "mainloop" which waits for
>any kind of user interaction (you needn't explicit programm this mainloop:
>in GUI programming it comes with the package)
>
>Michael
>
> >
> > Also, how do you get python (when you don't run it in DOS Prompt) to not
> > auto-exit? I have made a few simple programs, but as soon as it shows 
>the
> > answer, it exits.
> >
> > last, I was wondering how you do visual stuff, or make a program run in 
>a
> > window, instead of in the command prompt screen?
> >
> > Thanks,
> > Mike
> >
> > _________________________________________________________________
> > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus