Arul's Blog

Make Your Own Virtual Zoom Background

Sat 12 December 2020 By Arulmurugan Rajaraman comments

A lot of video calling software like Zoom and Google Hangouts now let users use a virtual background behind them. In this project, we'll show you how to make your own virtual background graphic in Python with Turtle that you can use in your video calls!

In this walkthrough, we will be drawing flowers on the screen, but you could do anything you would like to with your Python Turtle. We’ll look at how to set colors, add randomness, and more.

Who is this project for?

Introduction

This project falls under our Juni Python Level 1 coding class for kids. This beginner Python with Turtle tutorial is for students that want a easy/medium challenge project, about ~50 lines long. You should review functions, loops, and drawing basic shapes with Python Turtle beforehand to get the most out of this project.

Some other projects you can try first for more practice with Python with Turtle are our draw an animal face in Python and Python fireworks animation tutorials.

For learning outcomes, you'll get a lot of practice with functions and loops. This project is estimated to take you about 15 minutes, but you should move faster or slower at your own pace!

Project Demo

Before getting started, see how our finished project works for reference. Watch the video, or click run to see the project yourself!

You can also view my project solution code if you get stuck.

What to keep in mind before you start:

Consider how the shape of a flower can be drawn using different shapes.

Steps to Code the Project:

  1. Plan out how you'd draw a flower.
  2. Draw a petal.
  3. Draw a flower.
  4. Draw the scene.

How do we do each of these steps?

Step 1: First off, we’ll begin by thinking about how we can draw a flower.
  • What are the key parts of drawing a flower? The most accentuated portion of the flower could be their colorful petals. Let’s draw a flower’s petals together–you can add on a stem, center, and more if you would like.
Step 2: Draw a petal.
  • Let’s begin by drawing a petal. We can start with half of a petal. What does it look like?
  • One way to think about half a petal is that it looks like it is a cut-off top piece of a circle.
  • We can therefore combine two of these cut-off pieces at their edges, creating a petal!
  • For a visual explanation, check out the video!
  • We can use the turtle.circle(radius, extent) function in order to draw a circle with that radius, and drawn to that "extent", a value from 0 to 360 – e.g. 60 would draw 1/6th of the circle, as 60/360 = 1/6.
Step 3: Draw a flower.
  • We then take our petal, and make it into a function to draw it as many times as we want!
  • We should therefore make the code to draw a petal into a function, so we can reuse it and make sure that our code stays consistent.
  • Once we have the function to draw the petals, how do we draw the entire flower?
  • We can draw petals that all go out from the same point, with small rotations in between our petals. We can also calculate how much we need to rotate via 360 / numPetals to figure out how much we need to rotate before moving on.
  • We can also randomize color, radius, and number of petals to draw a random flower each time the function is called!
Step 4: Draw the scene.
  • We can color the background by using a special turtle named a Screen – this allows us to do screenTurtle.bgcolor("light blue"), for instance. If you want more custom colors, you can also use RGB values to select a specific color!
  • We can start by drawing a couple of flowers in random areas with random sizes and color.

Challenge Yourself with Extra Features

Creative Suggestions

  • Play around with the .circle(radius, extent) function and see what happens!
  • If you like having shapes in a certain area of the image, you can use the functions we defined to put them in specific locations.
  • Try your entirely own kind of background image!

This article originally appeared on junilearning.com.

comments powered by Disqus