intjelic / python-sfml

Official binding of SFML for Python
https://www.python-sfml.org
Other
176 stars 41 forks source link

XIO: fatal IO error 11 #156

Open tyuownu opened 7 years ago

tyuownu commented 7 years ago

Hi ALL I follow the tutorial, and after I type

w = sf.RenderWindow(sf.VideoMode(640, 480), "My first pySFML Window - or not ?")

It works, but after a while, the window is not responding. After I forced to close the window, it appeared:

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 503 requests (503 known processed) with 397 events remaining.

Environment: Ubuntu 16.04, 64bit, and pySFML 2.3.2.dev1(compiled by myself, I also tried other version, seems that the same.)

Thanks advance.

Necklaces commented 7 years ago

That tutorial has a lot of files; cute_image.png, arial.ttfm, nice_music.ogg. If you don't have the files the tutorial code will fail. It also looks like some of the code in that tutorial is outdated, GetEvent - for example - is not valid code any more.

I suggest try running this instead:

# Include the python-sfml extension
from sfml import sf

# Create the main window
window = sf.RenderWindow(sf.VideoMode(800, 600), "python-sfml test")

circle = sf.CircleShape(50)

# start the game loop
while window.is_open:
   # process events
   for event in window.events:
      # close window: exit
      if event == sf.Event.CLOSED:
          window.close()

   window.clear() # clear screen
   window.draw(circle) # draw the circle
   window.display() # update the window