google-code-export / simple-pygame-gui

Automatically exported from code.google.com/p/simple-pygame-gui
1 stars 1 forks source link

Quit button raises exceptions #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run 'python test.py'
2. press the 'Quit' button
3.

What is the expected output? What do you see instead?
The program should quit.  It does, but raises exceptions in the process:

File "/home/ostsol/src/spg-src-0.9.2/gui.py", line 693, in refresh
    self.textsurf = self.style['font'].render(self.text, True, self.style
['font-color'])
pygame.error: Text has zero width

What version of the product are you using? On what operating system?
0.9.2 on Kubuntu Intrepid

Please provide any additional information below.
Analysis: The lambda function launched by the 'Quit' button calls 
'pygame.quit()', which destroys the context, but it does not prevent the 
rest of the game loop from being run.
Solution: Line 66 should assign a function that changes the global 
variable 'run' to false.  Attached is a version of 'test.py' that applies 
this solution as well as the solution provided by Issue 2.

Original issue reported on code.google.com by Ost...@gmail.com on 5 Apr 2009 at 3:59

Attachments: