Code is Your Canvas

Share Code from any Device

Trinket lets you run and write code in any browser, on any device.

Trinkets work instantly, with no need to log in, download plugins, or install software.

Easily share or embed the code with your changes when you're done.

Trinket: run code anywhere

main.pyshapes.py

1

2

# You can edit this code and run it right here in the browser!

# First we'll import some turtles and shapes:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1

2

# This is a custom module we've made.

# Modules are files full of code that you can import into your programs.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Adding or removing images is disabled during broadcasting. You'll be able to update images again once the broadcast session is over.

Images

Images listed here are available to use in your code in this trinket. Click the Image Library button to include more or upload new images.

How To Use Images

Images can be used with the turtle module.

import turtle
screen = turtle.Screen()
# set the screen background
screen.bgpic("filename.png")

# Or, set the shape of a turtle
screen.addshape("filename.png")
tina = turtle.Turtle()
tina.shape("filename.png")

Run your code first!

It looks like you haven't tried running your new code.

Try clicking Run and if you like the result, try sharing again.

Trinket Settings

Enable Editor Autofocus

Global Settings

Enable Line Wrapping

Python Settings

Indentation Amount
(Doesn't update existing code!)

2 spaces 4 spaces

  • Email

  • Link

  • Embed

  • Download

  • with Group

  • Run

  • Console

Free Interactive Resources

Trinket is proud to present the following free resources in collaboration with open source authors and our non-profit partners.

Tutorials From Blocks to Code

Starting with Blocks, we look at the code underneath and learn some basics of Python!](https://hourofpython.trinket.io/from-blocks-to-code-with-trinket) Python with Turtles

A visual introduction to code using the Python programming language and Turtles.](https://hourofpython.trinket.io/a-visual-introduction-to-python)

Textbooks Think Java

An introduction to Java suitable for AP Java classes.](https://books.trinket.io/thinkjava) Python for Everybody

An introduction to Python suitable for a wide range of students.](https://books.trinket.io/pfe)