Page 1 of 1

python_games blank black screen

Posted: Sat Apr 18, 2015 4:14 pm
by diomoidapple
Hi, I am a complete noob to python, but I tried running one of the games in "python_games" that came with Rasbian. I ran

Code: Select all

python drawing.py
but after doing that all I have is a black blank screen. I cannot escape out of it in the normal ways I am used to (like ctrl-x, ctrl-d, etc.). Am I simply trapped and have to unplug and replug the raspberry pi, or is there some keystroke that I can press? Note that I am using Raspbian from the command line and did not run

Code: Select all

startx
.

Re: python_games blank black screen

Posted: Mon Apr 20, 2015 1:54 pm
by paddyg
:( Yes, that's really annoying isn't it. I think most of the demos use pygame and it relies on the xserver to be running. I'm not sure what method of breaking you can resort to (often ctrl | will work where ctrl c doesn't, but not in this case).

Re: python_games blank black screen

Posted: Mon Apr 20, 2015 4:28 pm
by DougieLawson
[CTRL]+[ALT]+[F2] gets you a new console where you can login and hit the hung process with some variant of the kill command.

Re: python_games blank black screen

Posted: Mon Apr 20, 2015 6:07 pm
by paddyg
@dougie it's more annoying than that. It's really annoying! I think I have tried every combination of two or three keys (starting with CtrlAltFn) I can log in over ssh from another computer but a) that's slightly less convenient than power off/on b) ssh doesn't have the full root killing capacity of direct tty so can't fix it (can't even reboot or halt the system)

Re: python_games blank black screen

Posted: Mon Apr 20, 2015 6:50 pm
by DougieLawson
paddyg wrote:@dougie it's more annoying than that. It's really annoying! I think I have tried every combination of two or three keys (starting with CtrlAltFn) I can log in over ssh from another computer but a) that's slightly less convenient than power off/on b) ssh doesn't have the full root killing capacity of direct tty so can't fix it (can't even reboot or halt the system)
Wow, that must be some very badly buggy code.

I wonder, if it ties the processor in a tight loop, would it be interruptible on a RPi2?

Re: python_games blank black screen

Posted: Mon Apr 20, 2015 7:28 pm
by paddyg
It looks to be pretty standard pygame, which I used to think was fairly safe...

Same thing happens with RPi1 or RPi2; with python2 or python3.

Running this seems to block the terminal inescapably (and all the examples in python_games are similar)

Code: Select all

import pygame, sys
from pygame.locals import *

pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello Pygame World!')
while True: # main game loop
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()