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

Author Topic: pySFML on linux how to make it work  (Read 9053 times)

0 Members and 1 Guest are viewing this topic.

m_p_w

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
pySFML on linux how to make it work
« on: September 09, 2016, 06:39:18 pm »
This might be stupid question, but I am not sure what do to. Basically I have install sfml-dev (2.3.2) and later python-sfml(2.2) and cython(0.23.4) because by my understanding python-sfml is "not a pure python library. Rather, it is a set of extensions that provide a Pythonic API around a C++ library. As such, every PySFML object is really a wrapped C++ object which can be manipulated through Python methods".

Now I have wrote a small program (displaying a window) in python, but I get error 'module' object has no attribute 'RenderWindow'.

What am I doing wrong? I am sorry for asking :(

I know it might sound like I am clinically retarded, but normally after installing pygame, I didn't have to link anything when programming in python in geany IDE, but when it comes to SFML and G++, I had to link the SFML libraries. It is possible that I have to link somehow pySFML (if so, how to do it)?

m_p_w

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: pySFML on linux how to make it work
« Reply #1 on: September 10, 2016, 12:14:30 am »
I managed to make it work!!!!!

import sfml as sf
from sfml import sf  # I added this line and it works 100% :D

window = sf.RenderWindow(sf.VideoMode(800, 600), "text example")



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

    window.clear()
    window.display()

m_p_w

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: pySFML on linux how to make it work
« Reply #2 on: September 10, 2016, 05:40:49 am »
Actually only "from sfml import sf" is needed