Python Forum

Full Version: Help with pygame but not an actual game
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all
I'm very new to Python and programming other than in Basic many years ago
I'm trying to get an Earthquake monitor working as Link to original project and code

I am able to get it working if I use a headless setup on a Pi 3b+ but with Raspbian lite only
It will not work on any other OS setup I have tried

I want it to work with the full version of Raspbian Debian version: 11 (bullseye) so it can be kept up to date and I can eventually if wanted integrate it into another project I have

The other project uses pygame but with the desktop version of Raspbian so I really need to figure out why it won't work

If anyone can help?

The error I get when I run it on the standard version of Bullseye is
pi@Earthquake:~ $ cd EQMap
pi@Earthquake:~/EQMap $ python3 EQMap.py
New Event
Traceback (most recent call last):
  File "/home/pi/EQMap/EQMap.py", line 155, in <module>
    main()
  File "/home/pi/EQMap/EQMap.py", line 137, in main
    repaintMap();
  File "/home/pi/EQMap/EQMap.py", line 61, in repaintMap
    displayManager.displayMagnitude(cqMag)
  File "/home/pi/EQMap/DisplayManager.py", line 144, in displayMagnitude
    self.drawCenteredText(self.topTextRow, "Mag: " + str(mag))
  File "/home/pi/EQMap/DisplayManager.py", line 96, in drawCenteredText
    textSurface, rect = self.font.render(text, 1, self.textColor)
TypeError: fgcolor must be a Color
pi@Earthquake:~/EQMap $ 
IF I bypass that error by assigning a color (which don't want to do as the color changes during the program run)
It gets a bit further then gives this error:
pi@Earthquake:~/EQMap $ python3 EQMap.py
New Event
Traceback (most recent call last):
  File "/home/pi/EQMap/EQMap.py", line 155, in <module>
    main()
  File "/home/pi/EQMap/EQMap.py", line 137, in main
    repaintMap();
  File "/home/pi/EQMap/EQMap.py", line 79, in repaintMap
    displayManager.mapEarthquake(lon, lat, mag, color)
  File "/home/pi/EQMap/DisplayManager.py", line 134, in mapEarthquake
    self.drawCircle(mapX, mapY, radius, color);
  File "/home/pi/EQMap/DisplayManager.py", line 119, in drawCircle
    pygame.draw.circle(self.screen, color, (x, y), radius, width=2)
TypeError: circle() takes no keyword arguments
pi@Earthquake:~/EQMap $ 
Can anyone tell me how to get this to run on a Pi that isn't headless and has a monitor attached to it?

It will "eventually" be merged with my weather display which is why I need it working on a proper monitor

I did contact the author of the project but he said he's moved onto other things.
I've attached the 2 sections of code that it relates to