Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Potato_Tempest

"Pausing" programs in python

This topic is 6010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
well iv no reply''s to this topic, so i thought maybe someone didnt understand my question. The question is basically:

How can I stop the program from closing itself after the program has done its job? Do I have to create a loop to the top of the program or something?

Share this post


Link to post
Share on other sites
getch() might work for you. dunno what exactly you''re wanting here but this pauses your program and waits for a key press

Share this post


Link to post
Share on other sites
ehhh? how would i use that? Yeah, im lookin for something that will pause the program until they press a key. Heres my program, mabye u can help me out:

  
#print menu
print "Area Caculation Program"
print "-----------------------"
print
print "Select a shape"
print "1. Rectangle"
print "2. Circle"
print "3. Triangle"
print "4. Trapazoid"


shape = input()

#get area

if shape == 1:
print "Area of a Rectangle"
print "---------------"
print
length = input("Please input length")
width = input("Please input width")
area = length*width
print "the area is", area

elif shape == 2:
print "Area of a Circle"
print "---------------"
print
radius = input("Please input the radius")
area = (3.14*radius)*radius
print "The area is", area

elif shape == 3:
print "Area of a Triangle"
print "------------------"
print
length = input("Please input length")
width = input("Please input width")
area = 0.5*(length*width)
print "The area is", area

elif shape == 4:
print "Area of a Trapazoid"
print "-------------------"
print
length = input("Please input length")
b = input("Please input the first width")
c = input("Please input the second width")
area = 0.5*length(b+c)
print "The area is", area

Share this post


Link to post
Share on other sites
I don''t know Python, but hiw about something like this at the end:

dummy = input("Press any key to exit.")

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!