Drawing Grass in Pygame

As part of my Python Pygame unit I am asking students to draw a landscape. Just for fun, I thought I would ask them to create a function to draw some grass at the bottom of the screen.

Here’s the function template I gave them:

Here’s an example I created with 1500 blades of grass, each being 10 pixels high and only drawing within the bottom 20% of the screen:

I’m leaving this post as a bit of a stub as it’s really only being posted to help my students visualize what the grass should look like. Perhaps I’ll post the core part of the Pygame program later on as a short tutorial.

If anyone is interested in seeing the code I used to generate the grass, please leave a comment below or contact me through Twitter and I’ll share it with you.


This is also a test of the WordPress.com for Google Docs add-on to see if it works. If you see this post, it worked!

Update: it seemed to work except I had to reformat the program code. I found that to be a nuisance so I’ve chosen to include a screenshot of the code instead.