Skip to content
Binary file added docs/img/night_sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rocketpanda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions docs/intermediate/20-installing-local-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
The next few labs are labs that must be run on your local computer because the will interact with the local operating system and local file system. You will not be able to use Trinket to run these programs.

The main site for Python is here:

[https://www.python.org/](https://www.python.org/)
[https://www.python.org/](https://www.python.org/)

If you go to that site there will be pages for Downloads and Documentation for each version of your desktop or PC.

Expand Down
122 changes: 0 additions & 122 deletions docs/intermediate/21-files.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/intermediate/22-images.md

This file was deleted.

16 changes: 10 additions & 6 deletions docs/trinket/00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ The map above is a visual guide to our Introduction to Python course. Students
For students that are new to programming, here are some sample programs (what we call learning labs) that you can try. You can learn by reading the sample programs, going to the Trinkit.io site and changing some values in the code. Each of the labs has experiments at the end you can do to extend to see if you have mastered the concepts before you go on to the next lab.

1. [Trinket Account](./01a-trinket-account.md) - introduction to the Turtle Graphs library with a list of drawing functions
1. [Turtle graphics](./01a-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions
2. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times
2. [Turtle graphics](./01b-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions
3. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times
4. [Variables](./03-variables.md) - add variables for the move edge distance and angle
5. [Loops](./04-loops.md) - add a loop to make our code smaller
6. [Conditionals](./05-conditionals.md) - add an if statement to change the color
7. [Functions](./06-functions.md) - create a shape function
8. [Function parameters](./07-function-parameters.md) - add parameters to our function
9. [Random](./08-random.md) - generate random numbers that are used do drive the turtle
9. [Lists](./08-list.md) - store a list of colors
10. [Inputs](./11-input.md) - get some input from the user
11. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree

10. [Lists](./08-list.md) - store a list of colors
11. [Inputs](./11-input.md) - get some input from the user
12. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree
13. [Shapes](./13-shape-module.md) - creating a separate module to draw shapes
14. [Color picker](./14-color-picker.md) - picking different colors
15. [Sine wave](./15-sine-wave.md) - creating a sine wave
16. [Changing Background](./16-changing-background.md) - changing background image and capturing keyboard
17. [Controlling MouseClicks](./17-controlling-mouseclicks.md) - Tracking mouse clicks

59 changes: 59 additions & 0 deletions docs/trinket/08b-random-stars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Random Circles

In this exercise we will draw 5 stars of different colors:
The colors are randomly picked from the list of colors
```
colorList = ['red', 'orange', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold']
mycolor = colorList[random.randint(0,len(colorList)-1)]
```
After these line runs, the variable mycolor will be assigned some random color from the list of colors myColorList. We will then use this color to fill a star.
The stars are drawn at random locations selected in x = random.randint(-max_distance, max_distance)
y = random.randint(-max_distance, max_distance)
The size of star is also randomly picked size = random.randint(15, 30)

## Sample Code
```python
import turtle
import random
# this is a list of colors
colorList = ['red', 'orange', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold']
dan = turtle.Turtle()
dan.shape('turtle')
dan.delay(1)
dan.clear()
dan.penup()

max_distance = 160

# draw an eight sided star
def star(x, y, size, color):
dan.goto(x, y)
dan.color(colorList[random.randint(0,len(colorList)-1)])
dan.pendown()
dan.begin_fill()
for i in range(1,8):
dan.forward(size)
dan.right(150)
dan.forward(size)
dan.left(100)
dan.end_fill()
dan.right(10)
dan.penup()

# draw a pattern at a random location on the screen
for i in range(5):
x = random.randint(-max_distance, max_distance)
y = random.randint(-max_distance, max_distance)
size = random.randint(15, 30)
color_index = random.randint(0,8)
# draw a star with size and color
star(x,y,size, color_index)

# hide so we have a nice drawing
dan.hideturtle()
```


## Experiments
1. Can you create a variable for the number of circles to draw?
2. Go to the [Trinket colors page](https://trinket.io/docs/colors) and see the name of other colors you can use. Note that you can use any of these colors in your lists.
7 changes: 7 additions & 0 deletions docs/trinket/08c-turtle-shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ for myShape in myList:
dan.shape(myShape)
time.sleep(1)
```


##Sample program
[Sample](https://trinket.io/library/trinkets/c9924a123a)

## Experiments
Can you use the new shapes to draw a star or any other shape of your chosing
38 changes: 0 additions & 38 deletions docs/trinket/13-random-stars.md

This file was deleted.

16 changes: 15 additions & 1 deletion docs/trinket/13-shape-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@

In this lab we will create a set of drawing function and put them together into a new file. We will then import this file into our main.py file.

Example code to import the module in main.py
``` py
import turtle
from shape import *
dan = turtle.Turtle()
dan.shape('turtle')

draw_triangle(dan, 'red', 5, 20, 30)

draw_circle(dan, 'orange', 10, 0, 30)

## Sample Code
draw_square(dan, 'orange', 15, -20, 30)
```


## Sample Codeimited t
```py
# This is a custom module we've made.
# Modules are files full of code that you can import into your programs.
# This one teaches our turtle to draw various shapes.
Expand Down
31 changes: 30 additions & 1 deletion docs/trinket/14-color-picker.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## Color Picker

[Color Picker](https://projects.raspberrypi.org/en/projects/colourful-creations/1)
You are not limited to the colors by name [Trinket Colors](https://trinket.io/docs/colors).
You can use Hex and RGB values and let your imagination run wild.

[Color Picker](https://projects.raspberrypi.org/en/projects/colourful-creations/1)

#Example code
```py

import turtle

#turtle.setup(400,500)
wn = turtle.Screen()
wn.setup(400,500)
#turtle.title("Tess becomes a traffic light!")
wn.bgcolor("A7E30E")
tess = turtle.Turtle()
tess.color('#FA057F')
style = ('Arial', 40, 'bold')
tess.write('Hello', font=style, align='Center')
tess.hideturtle()

```

## Experiments
Can you try different colors?
Can you change font properties in style object?

The font name can as 'Arial', 'Courier', or 'Times New Roman'
The font size in pixels.
The font type, which can be 'normal', 'bold', or 'italic'
23 changes: 23 additions & 0 deletions docs/trinket/16-changing-background.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Changing background and using keys to move the rocket

We can use trinkets to change the background and change the shape of the turtle with a custom image.
Also we can control the screen with the mouse. It gives a starting point for how to create a game.

The following blog lays out the steps for creating a rocket ship
https://blog.trinket.io/using-images-in-turtle-programs/


The images have to be the same size as the the screen size. Here are some other images that have been resized.

#Background
![Night Sky matching screen size](../img/night_sky.png)

#Rocketpanda
![Rocket panda](../img/rocketpanda.png)

## Sample Program
[Sample](https://trinket.io/library/trinkets/eacf1bc102)

## Experiments
1. Can you map another keyboard key to take some other actions like jump, draw a circle.
2. Use different images and create backgrounds of your choice, like rocketpanda gliding through night sky
Loading