1. Home
  2. /
  3. Processing-py
  4. /
  5. Multiple Shapes

Multiple Shapes - Processing-py Typing CST Test

Loading…

Multiple Shapes — Processing-py Code

Draws multiple shapes with different colors on the canvas.

def setup():
	size(400, 400)
	background(255)
	fill(255, 0, 0)
	rect(50, 50, 100, 100)
	fill(0, 255, 0)
	eclipse(300, 100, 80, 80)
	fill(0, 0, 255)
	line(50, 300, 350, 300)

Processing-py Language Guide

Processing.py is a Python mode of the Processing environment, allowing Python developers to create visual arts, animations, and interactive graphics easily using the Processing API.

Primary Use Cases

  • ▸Interactive visual arts projects
  • ▸Educational tools for teaching programming and graphics
  • ▸Rapid prototyping of visual ideas
  • ▸Data visualization and generative design
  • ▸Creative coding workshops and tutorials

Notable Features

  • ▸Python syntax support in Processing IDE
  • ▸Event-driven graphics and animation
  • ▸2D and 3D graphics APIs
  • ▸Integration with Processing libraries and sound/video tools
  • ▸Cross-platform sketches runnable on desktop and web via Processing.js

Origin & Creator

Processing was created in 2001 by Casey Reas and Ben Fry. Processing.py was added later as a Python mode to enable Python programmers to use Processing.

Industrial Note

Processing.py is mainly used in education, digital arts, generative design, and creative coding prototyping rather than commercial graphics engines.

Quick Explain

  • ▸Python syntax for creating visual sketches with Processing libraries.
  • ▸Supports 2D and 3D graphics rendering.
  • ▸Handles animations, user interaction, and event-driven programming.
  • ▸Bridges creative coding concepts with Python programming.
  • ▸Used for learning programming, generative art, and prototyping interactive visuals.

Core Features

  • ▸setup() - initializes the sketch
  • ▸draw() - continuously renders frames
  • ▸Shapes and colors - rect(), ellipse(), fill(), stroke()
  • ▸Interaction - mousePressed, keyPressed, etc.
  • ▸PVector - vector math for motion and physics

Learning Path

  • ▸Start with shapes, colors, and basic drawing
  • ▸Learn animation via draw() loop
  • ▸Explore event-driven interactions
  • ▸Study PVectors and 3D sketches
  • ▸Integrate libraries for sound, video, and interactivity

Practical Examples

  • ▸Animated bouncing ball
  • ▸Procedural tree generation
  • ▸Data-driven visualizations
  • ▸Interactive game prototypes
  • ▸Generative artwork with algorithmic patterns

Comparisons

  • ▸Processing.py vs Processing Java: Python syntax vs native Java
  • ▸Processing.py vs P5.js: Python desktop vs JavaScript web
  • ▸Processing.py vs Pygame: simpler creative coding vs game-oriented
  • ▸Processing.py vs OpenFrameworks: lightweight educational vs high-performance C++
  • ▸Processing.py vs Unity: creative coding vs professional game development

Strengths

  • ▸Easy for beginners to start visual programming
  • ▸Rapid feedback for creative experimentation
  • ▸Active community and many examples
  • ▸Cross-platform and lightweight
  • ▸Flexible for 2D and basic 3D graphics

Limitations

  • ▸Performance not suitable for complex 3D games
  • ▸Limited support for advanced GPU shaders
  • ▸Not intended for production software graphics
  • ▸Requires Processing IDE or compatible environment
  • ▸Python mode lags behind Java mode in some features

When NOT to Use

  • ▸Performance-critical applications
  • ▸Complex 3D game engines
  • ▸Large-scale software development
  • ▸GPU-intensive rendering pipelines
  • ▸Production-level graphics applications

Cheat Sheet

  • ▸setup() - initializes the sketch
  • ▸draw() - main animation loop
  • ▸rect(x, y, w, h) - draw rectangle
  • ▸ellipse(x, y, w, h) - draw circle/ellipse
  • ▸fill(color) / stroke(color) - color settings

FAQ

  • ▸Is Processing.py just for beginners? -> Mostly, but can do advanced creative coding.
  • ▸Can it run outside Processing IDE? -> Yes, via exported applications.
  • ▸Does Processing.py support 3D? -> Yes, basic 3D with P3D renderer.
  • ▸Can Python libraries be used? -> Limited to Jython-compatible ones.
  • ▸Is Processing.py good for games? -> Simple prototypes only, not production-grade games.

30-Day Skill Plan

  • ▸Week 1: Basic sketches and drawing functions
  • ▸Week 2: Animations and simple interactions
  • ▸Week 3: Working with images, fonts, and sounds
  • ▸Week 4: Generative art and algorithmic design
  • ▸Week 5: Advanced interactive projects with multiple libraries

Final Summary

  • ▸Processing.py brings Processing’s visual and interactive capabilities to Python programmers.
  • ▸It uses event-driven programming with setup() and draw().
  • ▸Supports 2D and 3D graphics, interactivity, and multimedia.
  • ▸Great for learning, prototyping, and creative coding.
  • ▸Mostly educational and artistic, not for high-performance applications.

Project Structure

  • ▸sketch.pyde - main Python sketch file
  • ▸data/ - assets like images, fonts, or sounds
  • ▸libraries/ - optional Processing libraries
  • ▸export/ - exported application or applet
  • ▸docs/ - notes and resources

Monetization

  • ▸Primarily educational or portfolio use
  • ▸Sell interactive art or installations
  • ▸Workshops and tutorials
  • ▸Freelance visual projects
  • ▸Creative coding content for media

Productivity Tips

  • ▸Start with minimal code and incrementally add features
  • ▸Use sketches as experiments
  • ▸Organize assets in data folder
  • ▸Leverage examples and community code
  • ▸Test often and iterate quickly

Basic Concepts

  • ▸Sketch - the program defining visual output
  • ▸setup() - runs once at start
  • ▸draw() - continuously executes to animate
  • ▸Events - functions triggered by input
  • ▸PVector - represents points and vectors in 2D/3D space

Official Docs

  • ▸https://processing.org/tutorials/python/
  • ▸https://py.processing.org/reference/

More Processing-py Typing Exercises

Hello World in Processing.pyDraw a CircleAnimated RectangleInteractive EllipseSimple Animation LoopColor Changing BackgroundBouncing BallRandom LinesMouse Trail

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher