Skip to main content

A library the uses PyQt5 for setting up apps with a window to programatically draw in.

Project description

PyQtPaint

This is still a work in progress, but basic functionality is present. A library of boilerplate code using the PyQt5 library. Used for creating a window to draw in and having an application and update thread. Also comes with some predefined objects to add to the window for drawing.

Installation:

  • Github:
git clone https://github.com/WafflerThe/PyQtPaint
pip install PyQtPaint
  • pip:
pip install PyQtPaint==0.1.0

Modules

  • PyQtPaint.app: Contains the App abstract class for running the window and updates to it.

  • PyQtPaint.form: Contains the PainterWindow class of which objects can be added and removed from it. These objects will be painted on every update call.

  • PyQtPaint.objects: Contains the PainterObject abstract class which descendants will have paint methods and other styling methods for customizing the object.

Examples:

Press esc to close.

  • tree_app.py
  • mouse_app.py

How to use:

The expected way to use this library to to create a class that extends App. The subclass can override various methods inside of App and there are options for further customization.

App Options:

These will be keyword arguments that are passed into the super constructor.

  • auto_update: Defaults to True; determines if an asynchronous thread should be made and ran
  • fps: Defaults to 30; will be the amount of times the update method is called in a second
  • mouse_tracking: Defaults to False; Will not capture mouse movements unless a button is down when False
  • title: Defaults to Painter Window; The title to be displayed on the window
  • fullscreen: Defaults to False; If True the window will be in fullscreen mode
  • size: The size of the window as a tuple (width, height)
  • width: Defaults to 600; If not size the width of the window
  • height: Defaults to 600; If not size the height of the window
  • position: Defaults to (0, 0); Where the window should be placed on the screen
  • render_hint: Defaults to QPainter.Antialiasing; The render hint the window should use when painting
  • background: Defaults to QBrush(Qt.black); The QBrush the background should use

Methods to override:

Standard:

  • setup_objects:
    • Automatically called in the constructor
    • Where the initial painter objects should be added to the window
  • update:
    • When auto_update is True will be called asynchronously multiple times a second based on fps
    • When auto_update is False call update manually when you need a repaint

Events:

They will all have an event parameter

Keys:
  • keyPress
  • keyRelease
Mouse:
  • mousePress
  • mouseRelease
  • mouseDouble
  • mouseMove
  • mouseEnter
  • mouseLeave
  • mouseWheel

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

pyqtpaint-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

pyqtpaint-0.2.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqtpaint-0.2.0.tar.gz.

File metadata

  • Download URL: pyqtpaint-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for pyqtpaint-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0765bfb451036ff079b3659dca544d10f0e7dd45c2423e6743432b288b828c39
MD5 207f7a2db51ae76290a3b1b7b01b59b4
BLAKE2b-256 b3210710a7e93d17b6fe57c77a79c3d3a4287822a2717b6601384791d073cd3a

See more details on using hashes here.

File details

Details for the file pyqtpaint-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyqtpaint-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for pyqtpaint-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5dd876ac9a85c03159d6af314ceab7e481eaf860367abadcf46c155a0ed166a5
MD5 ac48bf4da311fcc2ef859fc8929f4385
BLAKE2b-256 69ae0870e13e9db566dbb58bb5864553104217b45919dffcf6d39048717ace81

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