In the Mu Editor there are some built-in tools for easily making Graphical User Interfaces (GUI Zero) and Games. The game environment is PyGame Zero which is a "zero boilerplate" version of PyGame. Mu makes it even easier to use by running it in the correct environment and giving you quick access to the correct folders for images and sound.
Have a quick look at the intro video on the Mu Editor site: codewith.mu tutorial pgzero
Then work through the tutorial at the pygame-zero docs: pygame zero: introduction'
The documentation is pretty good and Googling does help, just make sure you don't confuse PyGame with PyGame zero advice (you can use the latter, but it requires more understanding).
Resources
Here's a quick example to demonstrate some of the basic features of Pygame Zero.
This "game" does not have user interaction. However, you can easily add user interaction by using the event handling hooks.
See the documentation for more.
# Magic global variables to set the window properties
WIDTH, HEIGHT = 320, 400
TITLE = "Alien Bouncer"
# New sprite using "alien.png" image shipped with Mu
alien = Actor("alien")
# Set its initial position and velocity
alien.x, alien.y = WIDTH/2, HEIGHT/2
alien.vx, alien.vy = 6, 7
# Runs 60 times per second by default
def draw():
screen.clear()
alien.draw()
# Runs 60 times per second by default
def update():
# Move the alien
alien.x = alien.x + alien.vx
alien.y = alien.y + alien.vy
# Check position on screen and bounce
if alien.left < 0 or alien.right > WIDTH:
alien.vx = -alien.vx
if alien.top < 0 or alien.bottom > HEIGHT:
alien.vy = -alien.vy
Here's a line art example that uses the Pygame scheduler to get custom update frequency
WIDTH, HEIGHT = 400, 400
x, y = 0, 0
def next_line():
global x, y
screen.draw.line((x,0), (0, HEIGHT-y), "red")
screen.draw.line((x,HEIGHT), (WIDTH, HEIGHT-y),
"blue")
x += 10; y += 10
if x > WIDTH or x > HEIGHT:
clock.unschedule(next_line)
print("done!")
clock.schedule_interval(next_line, 0.1)
A small change in the next line function can give other shapes like that to the left.