My first issue is super small but in the Pygame version of Gasp the begin_graphics() function has the parameter screen_title while Tkinter uses title, so assigning arguments using the parameter name and '=' causes an error.
Secondly, in my efforts to run the Robots game in Tkinter Gasp, I found there is no way to draw circles (used to show the player for the game). Below I have attempted to solve the issue. It seems to work when I have tried it, but deserves further testing and optimization.
class Circle:
"""Draw a circle centered at the given coordinates with the given radius"""
def __init__(self, position, radius, color=color.BLACK, filled=False):
self.x = position[0]
self.y = position[1]
self.radius = radius
self.color = color
self.filled = filled
x0 = self.x - self.radius
y0 = self.y - self.radius
x1 = self.x + self.radius
y1 = self.y + self.radius
if filled:
fill = color
else:
fill = ""
self.id = _canvas.create_oval(x0, y0, x1, y1, outline=color, fill=fill)
_canvas.update()
def __repr__(self):
return f"<Circle object centered at ({self.position}) with a radius of {self.radius}"
Lastly, Tkinter Gasp has no function for update_when to handle keystrokes as game input. Solving this issue might be beyond my current skillset.
All bugs are on Python 3.8.2 on my MacBook Pro running Catalina 10.15.5