470,849 Members | 1,208 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

NumTut view of greece

Hi

not sure if this would be the right place to ask this question!
using the shell prompt
:~$ python
Python 2.3.5 (#2, Mar 6 2006, 10:12:24)
[GCC 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import Numeric
from NumTut import *
view(greece)

shows a photo of the street in a tk window.

but if I have this file
**************** tut.py ****************
#!/usr/bin/env python
import Numeric
from NumTut import *
view(greece)
print "done"
************************************************** **************
and then type
$ ./tut.py
done
$
and not tk view of greece.

thanks
May 7 '06 #1
1 1480
Gary Wessle wrote:
Hi

not sure if this would be the right place to ask this question!
using the shell prompt
:~$ python
Python 2.3.5 (#2, Mar 6 2006, 10:12:24)
[GCC 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import Numeric
from NumTut import *
view(greece)
shows a photo of the street in a tk window.

but if I have this file
**************** tut.py ****************
#!/usr/bin/env python
import Numeric
from NumTut import *
view(greece)
print "done"
************************************************* ***************
and then type
$ ./tut.py
done
$
and not tk view of greece.

That's because, as soon as the program quits, the view window is removed.

In your interactive example, the view command opens the window, and then
immediately starts waiting for you to type the next command. Python is
still running and so the view window stays up.

In the non-interactive case, as soon as the view command executes,
Python immediately goes to the next line, does the print, then exits.
The view command, which was busily preparing to show your picture is
shut down when python exits before it had enough time to open the
window. (It was trying -- it just didn't have enough time.)

If you don't want the program to quit that quickly, you need to put in
something to keep it from running off the bottom and exiting. I'd
suggest something like this after the view line:

raw_input("Type ENTER when done viewing: ")

Gary Herron

thanks


May 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.