0 Members and 2 Guests are viewing this topic.
AttributeError: module 'sfml.sf' has no attribute 'CloseEvent'
from sfml import sf# create the main windowwindow = sf.RenderWindow(sf.VideoMode(640, 480), "pySFML Window")try: pass # load a sprite to display #texture = sf.Texture.from_file("cute_image.png") #sprite = sf.Sprite(texture) ## create some graphical text to display #font = sf.Font.from_file("arial.ttf") #text = sf.Text("Hello SFML", font, 50) ## load music to play #music = sf.Music.from_file("nice_music.ogg")except IOError: exit(1)# play the music#music.play()# start the game loopwhile window.is_open: # process events for event in window.events: # close window: exit if type(event) is sf.CloseEvent: window.close() window.clear() # clear screen #window.draw(sprite) # draw the sprite #window.draw(text) # draw the string window.display() # update the window
# start the game loopwhile window.is_open: # process events for event in window.events: # close window: exit if event == sf.Event.CLOSED: window.close()