Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Trouble with pysfml and Windows 7  (Read 6402 times)

0 Members and 1 Guest are viewing this topic.

hugoruscitti

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://www.losersjuegos.com.ar
Trouble with pysfml and Windows 7
« on: April 04, 2011, 12:39:52 am »
Hi, i'm having trouble getting pysfml to work on windows 7.

I run this test code, it only wait two seconds and then
close the main window.

Code: [Select]

import time
from PySFML import sf
window = sf.RenderWindow(sf.VideoMode(320, 240), "Test")

texto = sf.String("Esperando 2 segundos ...")
window.Clear(sf.Color.Green)
window.Draw(texto)
window.Display()

time.sleep(2)

window.Close()


But, when main window close, i get an error saying:



PySFML works on Windows 7?

Thanks in advance for any help.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Trouble with pysfml and Windows 7
« Reply #1 on: April 04, 2011, 12:45:16 am »
Sounds like the ATI bug? Do you have PySFML compiled with the latest revision of SFML?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Trouble with pysfml and Windows 7
« Reply #2 on: April 04, 2011, 04:45:19 pm »
It's been a while since I used the current binding, but I think I randomly had this kind of error at the end of the program. In practice it didn't stop the program from working.

What happens if you use proper event handling to close the window, as in the tutorial?

Code: [Select]
# Include the PySFML extension
from PySFML import sf

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

# Create a graphical string to display
text = sf.String("Hello SFML")

# Start the game loop
running = True
while running:
    event = sf.Event()
    while window.GetEvent(event):
        if event.Type == sf.Event.Closed:
            running = False

    # Clear screen, draw the text, and update the window
    window.Clear()
    window.Draw(text)
    window.Display()


Edit: if you want, you can try my new binding for SFML 2: https://bitbucket.org/bastienleonard/pysfml2-cython.
But you'll need to compile it yourself, I can't compile SFML 2 on Windows for some reason.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

hugoruscitti

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://www.losersjuegos.com.ar
Trouble with pysfml and Windows 7
« Reply #3 on: April 09, 2011, 06:00:37 am »
Hi, thanks for reply. I check again with your example and
get the same result, the program freeze when i close it:



I will compile SFML 2 and go to check again with your binding, i will
write again to tell you the results.

Thanks!!!

 

anything