Search code examples
pythonpython-3.xpymunk

PyMunk does not create window - Python


I am trying to learn PyMunk library and I used the example from their website. Here is a code:

import pymunk               # Import pymunk..

space = pymunk.Space()      # Create a Space which contain the simulation
space.gravity = 0,-1000     # Set its gravity

body = pymunk.Body(1,1666)  # Create a Body with mass and moment
body.position = 50,100      # Set the position of the body

poly = pymunk.Poly.create_box(body) # Create a box shape and attach to body
space.add(body, poly)       # Add both body and shape to the simulation

while True:                 # Infinite loop simulation
    space.step(0.02)        # Step the simulation one step forward

When I run it the window does not show up and in CMD it says: Loading chipmunk for Windows (64bit) [C:\Users\Theo\AppData\Local\Programs\Python\Python35\lib\site-packages\pymunk\chipmunk.dll] and does not load anything. I waited for an hour. What is the problem?


Solution

  • You should try connecting PyMunk with PyGame or PyGlet to be able to viualize any results through a window. See more here: http://www.pymunk.org/en/latest/