LAZR.PW
Stuff I'm working on.

Thursday, 9 July 2015

pySFML Mouse Single Click

See as there isn't much decent documentation for pySFML that I can find, I'll put this here as a reference snippet for using the input events.

for event in self.window.events:
 if type(event) is sf.CloseEvent:
  self.window.close()

 if type(event) is sf.KeyEvent and event.code is sf.Keyboard.ESCAPE:
  self.window.close()
    
 if type(event) is sf.window.MouseButtonEvent and event.button is sf.Mouse.LEFT and event.pressed:
  self.mousePos = sf.Mouse.get_position(self.window)