Skip to main content

simple yet all you need for protyping

Project description

pysimpledraw

pysimpledraw is a simple drawing application built with Python, using FreeSimpleGUI for the graphical user interface and tkinter for canvas operations. It allows users to create and manipulate basic shapes, add text, import images, and perform common drawing operations.

Screenshots

Why pysimpledraw?

pysimpledraw aims to provide a lightweight and easy-to-use drawing tool for quick sketches, annotations, or simple diagrams. It serves as a demonstration of how to integrate FreeSimpleGUI with tkinter for creating interactive graphical applications.

Features

  • Drawing Tools: Rectangle, Circle, Line, Freehand, Triangle, Diamond.
  • Text Tool: Add and edit text on the canvas.
  • Color Palette: Predefined colors (Black, Red, Green) and a custom color chooser.
  • Line Thickness: Thin and Thick options.
  • Eraser: Remove objects from the canvas.
  • Object Manipulation:
    • Select and move objects.
    • Delete selected objects.
    • Resize text (Small, Medium, Large via context menu).
    • Resize imported images (via context menu with preset ratios).
  • Image Import:
    • Import an image as a background.
    • Import pictures as draggable and resizable objects.
  • Canvas Operations:
    • Clear All: Resets the canvas.
    • Undo/Redo: Revert and reapply actions.
    • Save: Save the current canvas content as an image (e.g., PNG).
    • Pan: Right-click and drag on empty canvas space.
  • Context Menus:
    • Middle-click on text objects for size options.
    • Middle-click on image objects for resize options.
  • Keyboard Shortcuts: Quick access to tools and actions.

Installation

  1. Clone the repository (if applicable):
    git clone <your-repository-link>
    cd pysimpledraw
    
  2. Ensure Python is installed. (Python 3.6+ recommended)
  3. Install dependencies: The application relies on FreeSimpleGUI, Pillow (PIL), and pyperclip. You can install them using pip:
    pip install FreeSimpleGUI Pillow pyperclip
    
    Or, if a requirements.txt file is provided:
    pip install -r requirements.txt
    
    (Note: A pyproject.toml is present, which might be used with tools like Poetry or Hatch for dependency management. If so, follow their respective installation procedures.)

Usage

As a Standalone Script

Navigate to the directory containing main.py (e.g., pysimpledraw) and run:

python main.py

As a Package (using -m)

If pysimpledraw is structured as a runnable package (e.g., with an __main__.py or if main.py is intended to be run this way), you might be able to run it from the parent directory (pysimpledraw):

python -m pysimpledraw.main

(This assumes pysimpledraw is in your Python path or you are in the pysimpledraw directory which contains pysimpledraw.)

GUI Features and Operations

The application window is divided into sections: Instructions, Tools, and the Canvas.

Instructions Panel

  • Mouse:
    • Left Button: Draw shapes or add text (double-click).
    • Middle Button: Access context menus for text (size) or images (resize).
    • Right Button: Select objects, move selected objects, or pan the canvas (if clicking on empty space).
  • Double Click:
    • On an existing text object: Edit the text.
    • On an empty area: Place new text.
  • Shortcuts: See the "Keyboard Shortcuts" section below.

Tools Panel

Shape Tools:

  • r ectangle: Selects the rectangle drawing tool.
  • c ircle: Selects the circle drawing tool.
  • a rrow: Selects the arrow drawing tool.
  • t line: Selects the line drawing tool.
  • f ree: Selects the freehand drawing tool.
  • T riangle: Selects the triangle drawing tool.
  • d iamond: Selects the diamond drawing tool.
  • e rase: Selects the eraser tool (click on an object to delete it).

Color Tools:

  • Black, Red, Green: Set the current drawing color.
  • ... (Custom Color): Opens a color chooser dialog.

Thickness Tools:

  • 1 Thin: Sets line thickness to thin.
  • 2 Thick: Sets line thickness to thick.

Action Buttons:

  • Clear All: Clears all drawings from the canvas.
  • Undo: Reverts the last action.
  • Redo: Reapplies the last undone action.
  • Save: Opens a dialog to save the canvas content as an image file.
  • Import Background: Imports an image to set as the canvas background.
  • Import Picture: Imports an image as a movable and resizable object on the canvas.

Canvas

  • The main drawing area.
  • Supports panning by right-clicking and dragging on an empty area.
  • Objects can be selected by right-clicking on them. Multiple objects can be selected by right-clicking and dragging a selection box (though this feature might depend on the exact implementation details for multi-select).

Keyboard Shortcuts

The application supports the following keyboard shortcuts:

  • Shape Selection:
    • r: Rectangle
    • c: Circle
    • t: Line
    • f: Freehand
    • T (Shift + t): Triangle
    • d: Diamond
    • e: Eraser
  • Color Selection:
    • B (Shift + b): Black
    • R (Shift + r): Red
    • G (Shift + g): Green
  • Thickness Selection:
    • 1: Thin
    • 2: Thick
  • Object Deletion:
    • Delete: Deletes the currently selected object(s).

Contributing

Found a bug or have a feature request? Please open an issue on the GitHub repository.

GitHub Repository: [https://github.com/fxyzbtc/pysimpledraw]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysimpledraw-0.1.1.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysimpledraw-0.1.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file pysimpledraw-0.1.1.tar.gz.

File metadata

  • Download URL: pysimpledraw-0.1.1.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.25

File hashes

Hashes for pysimpledraw-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bad97dc8ac0e312810762202f267dbea4c2482fda32224ecdb31d5098f620615
MD5 23edbc1f1dd2be1cea9637f1900038fc
BLAKE2b-256 334a3760cb865ed16926d10e68f1f278d2622d1e435e409507a076e12bb85455

See more details on using hashes here.

File details

Details for the file pysimpledraw-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pysimpledraw-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 190844c91d60bc3d73caa2acdb7f2818ec956076fd2c3a2e12b4f9ea95a7bba5
MD5 8ed7cb54f06382d361921991f14ec172
BLAKE2b-256 d7318b093cea3bda708a78d3af6675b6cc6f18b46bd737e1f09d2712061495a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page