godisreal / group-social-force

Multi-Agent Simulation of Collective Behavior (Pedestrian Crowd)
24 stars 6 forks source link

Does not work in Python 3.7.3 with Pygame 1.9.5 #5

Closed chraibi closed 4 years ago

chraibi commented 5 years ago

After fixing some nasty errors related to mixed spaces and tabs, I run

python 3Particles/simulator_WP0817_3Particles.py

and see an empty windows Screenshot 2019-04-04 at 20 35 40

After clicking on the red x (close the window) a new window pops up

Screenshot 2019-04-04 at 20 35 53

Closing this one closes also the other one, and that's it.

Am I supposed to see some circles moving around or not? 🤔

godisreal commented 5 years ago

Thanks for your interest. It seems that the source code is able to run on your computer, and there may be something wrong with pygame. I do not know why the simulation screen is blank.
Yes. You are supposed to see three circles moving around. The simulation was recorded in 3Particles.swf. So do you run any other Python program with pygame? So others are OK and only this one is blank on screen? Please let me know whether you can debug it or not. I compiled the code in Python 2.7 with Pygame 1.9. Based on your description, it seems that pygame.draw.line() and pygame.draw.circle() does not output on the screen.

Sorry for the error about tabs and spaces. In fact the text edior confuses me a little. I previously selected TABS and SPACES, and it caused an unexpected problem as you mentioned. So I should only use SPACES and set TAB = 4 spaces. Is that right? Anyway, you are also welcome to give a pull request if you have already fixed this error.

chraibi commented 5 years ago

I use pygame 1.9.5 and Python 3.7.3. I did not check other pygame-examples. Just wanted to see what this simulation is all about.. Yes, four spaces everywhere seem to be a good idea.

godisreal commented 5 years ago

Please try the following program to test the pygame in Python 3.7. If it does not work in your computer, it is probably a setup problem of pygrame with Python 3.7. I am not sure. Just try it. There is no problem in computational model in the existing code. Thank you for your question.

godisreal commented 4 years ago

The problem may be related to pygame._view.

When I use py2exe to get an execuable, the execuable file is successfully produced. However, when I run it, it returns the following error message. I think the these problems are perhaps related issues.


C:\Documents and Settings\WP\Desktop\PySim\Test_py2exe\dist>simulator_WP_Doorway
.exe
simulator_WP_Doorway.exe:4: RuntimeWarning: import display: No module named _view
(ImportError: No module named _view)
simulator_WP_Doorway.exe:4: RuntimeWarning: import draw: No module named _view
(ImportError: No module named _view)
simulator_WP_Doorway.exe:4: RuntimeWarning: import image: No module named _view
(ImportError: No module named _view)
simulator_WP_Doorway.exe:4: RuntimeWarning: import pixelcopy: No module named _view
(ImportError: No module named _view)
simulator_WP_Doorway.exe:4: RuntimeWarning: import transform: No module named _view
(ImportError: No module named _view)
Traceback (most recent call last):
  File "simulator_WP_Doorway.py", line 5, in <module>
  File "pygame\draw.pyc", line 12, in <module>
  File "pygame\draw.pyc", line 10, in __load
  File "pygame\surface.pyc", line 12, in <module>
  File "pygame\surface.pyc", line 10, in __load
ImportError: No module named _view
godisreal commented 4 years ago

OK. So the developers of Pygame replied that the problem is related to OSX for mac users. The details are listed as below.
"Looking at the linked issue on the other github repo I'm almost certain this is just the standard 'modern OSX doesn't work with pygame 1/SDL1' issue we get reported every other week. Don't think there is any work for pygame here, other than telling people on mac to use pygame 2 whenever they ask, so I think I'll close this for now." --- By MyreMylar commented May 31, 2020