2

I am working with OSX Yosemite. Here is my code:

http://pastebin.com/AWGu37z4

Here is my input file (to run it, just do python myscript.py myinput.txt):

http://pastebin.com/ueaeY0Ss

When I press the s button, a TK window should appear to show an text input box. If I cut and paste the code to just show the window and run it on its own, it works fine. However, if I run it in the middle of the simulation with the pygame window open and running, I get the following error (abort trap 6):

http://pastebin.com/TCwUxjCM

I have no idea on what this could be, nor on how to solve it.

Matteo Monti
  • 8,362
  • 19
  • 68
  • 114
  • I have used Tkinter with Pygame just once to make an initial menu for a game (before starting the Pygame's loop). I think your problem is expectable, because you are trying to run the Tk mainloop contemporarily to the main loop of Pygame. This of course can cause problems... There are some post on SO that talks about possible solutions... – nbro Mar 19 '15 at 15:20

1 Answers1

1

I had the same problem and finally got my program to work by changing the order: the pygame loop has to start after the tk window/mainloop.

I am using macosx mojave 10.14.3 and python3.7 with pygame 1.9.6

cmh5115
  • 11
  • 1