Re: [pygame] Gracefully exiting with errors

2015-08-26 Thread rockachu2
Some example code: Try: While running: .pygame.update .etc Pygame.quit Except exception: Pygame.quit() Raise That way even if it errors we still call pygame.quit(), which is what isn't happening since the idle doesn't call garbage collection on some code

Re: [pygame] Gracefully exiting with errors

2015-08-26 Thread rockachu2
I believe the issue your having is when the code throws an exception, pygame.quit() is never called ( in idle) so the window persists. A good way to deal with this is to wrap the execution in a try/except that calls pygame.quit then re raises the exception. > On Aug 26, 2015, at 14:23, Paul

Re: [pygame] Gracefully exiting with errors

2015-08-26 Thread Paul Vincent Craven
When using Wing, I teach students to hit the red 'stop' button. The issue is when the process errors, it does not quit, it pauses. Thus the windows stays open and is unresponsive. By hitting the red square 'stop' button, you kill the process. Paul Vincent Craven On Wed, Aug 26, 2015 at 1:29 PM, b

RE:[pygame] Difference between flip and update?

2015-08-26 Thread Yann Thorimbert
"short answer: update() is usually faster than flip()." ==> I do not agree. It depends on the area of the surface to be updated. In most cases, update() is really needed only if one needs to update only a few fractions of the screen each frame. Moreover, even in that case, flip() could be suffi

Re: [pygame] Difference between flip and update?

2015-08-26 Thread tom arnall
short answer: update() is usually faster than flip(). On 8/26/15, Bob Irving wrote: > What is the difference? Is there a reason to use one over the other? > > Thanks! > Bob Irving > Porter-Gaud School > Charleston, SC > > -- > Twitter: @birv2 > www.bob-irving.com > http://www.scoop.it/t/on-the-d

Re: [pygame] Difference between flip and update?

2015-08-26 Thread bw
Hi again, Bob. From a teaching standpoint... flip updates the entire screen by swapping display buffers each game loop. update uses dirty rects to define the regions that need to be drawn each game loop. update is harder to learn and use. You have to track the areas of the screen that were

Re: [pygame] Gracefully exiting with errors

2015-08-26 Thread bw
I agree with Ian. You should just be able to allow the script to end without special closure. But you may also use sys.exit() and quit(). pygame.quit() is not usually needed, unless you intend to quit pygame and let the program continue onto something else. What you're seeing, Bob, may be a pr

Re: [pygame] Difference between flip and update?

2015-08-26 Thread Ian Mallett
On Wed, Aug 26, 2015 at 11:40 AM, Bob Irving wrote: > What is the difference? Is there a reason to use one over the other? > ​The docs are pretty clear on the basic difference. Do you have a more specific question?​

Re: [pygame] Gracefully exiting with errors

2015-08-26 Thread Ian Mallett
On Wed, Aug 26, 2015 at 11:38 AM, Bob Irving wrote: > Is there a way to exit your game gracefully when there are errors? We have > found with both IDLE and WingIDE that the game hangs, requiring several > clicks of the X, etc. > > We are ending our game loop with > > pygame.quit() > sys.exit() >

[pygame] Difference between flip and update?

2015-08-26 Thread Bob Irving
What is the difference? Is there a reason to use one over the other? Thanks! Bob Irving Porter-Gaud School Charleston, SC -- Twitter: @birv2 www.bob-irving.com http://www.scoop.it/t/on-the-digital-frontier

[pygame] Gracefully exiting with errors

2015-08-26 Thread Bob Irving
Hello all, I teach Pygame in 9th grade computer science, and this is our first year using Python/Pygame (we previously used BlitzBasic). Is there a way to exit your game gracefully when there are errors? We have found with both IDLE and WingIDE that the game hangs, requiring several clicks of the

Re: [pygame] possible to get rid of ghost image after rotating a line?

2015-08-26 Thread James Heslin
Hi Tom, Further resources for doing the work in maths and rendering the results: I wrote a framework thing called PyStroke a couple of years ago, intended to avoid sprites altogether and only use collections of lines. Perhaps it would be useful for you? https://github.com/PROGRAM-IX/pystroke Examp