Code: Select all
import pygame, sys from pygame.locals import * pygame.init() windowSurfaceObj = pygame.display.set_mode((640,480),1,16) print ("To switch light ON prees 'y' key ") print ("To switch light OFF press? 'n' key ") while True: x = 1 for event in pygame.event.get(): if event.type == KEYDOWN and event.key == K_y: print ("light on") elif event.type == KEYDOWN and event.key == K_n: print ("light off")
I'd prefer to call it a process of eliminationdox wrote:Hi Gordon,
Thanks for solving this by trial and error for me.
Just for your interest I have bought the raspberry-pi and I am refreshing my programming experience so that I can automate a fireworks display for the grandchildren next Nov 5th. I have most of the hardware sorted out, but now need to get the program sorted.
Sleep Mode zZ wrote: Some posts indicate that the keyboard events won't work with the dummy driver:
http://www.raspberrypi.org/forums/viewt ... 96#p363390
http://www.raspberrypi.org/forums/viewt ... 8&p=359897
http://www.raspberrypi.org/forums/viewt ... 18#p491654
http://pygame-users.25799.x6.nabble.com ... td719.html