Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
#Make sure to credit me in any art/modifications you make from turtle import Turtle draw = Turtle() draw.penup() draw.home() draw.shape("square") #end turtle setup #The "uS" variable defines a unit grid space. uS = 20 #define colors cl0 = "#000000" cl1 = "#FFFFFF" #begin map #define the color of each pixel map0 = [0, 0, 0, 0, 0] map1 = [0, 0, 0, 0, 0] map2 = [0, 0, 0, 0, 0] map3 = [0, 0, 0, 0, 0] map4 = [0, 0, 0, 0, 0] #define the full map, plus picture width and height mapFull = [map0, map1, map2, map3, map4] width = 5 height = 5 BGcol = "#FFFFFF" #end map #actual printing algorithm. Be careful when modifying it! print "GalactaTron Pixel Printer Omega: template" print str(width) + " pixels (wide) by " + str(height) + " pixels (high)" draw.pensize(1000) draw.pencolor(BGcol) draw.pendown() draw.fd(1) draw.penup() draw.home() draw.pensize(25) for cS in range(height): for cI in range(width): draw.goto(cI * 20, 0 - (cS * 20)) mapRow = mapFull[cS] if not(mapRow[cI] == 0): draw.pencolor(mapRow[cI]) draw.pendown() draw.fd(1) draw.bk(1) draw.penup()
G-TronPixPrintOm_template.py
( around 45 lines python code )
Published By:
Great Goose
Published on
2023-01-09T13:19:09Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here