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.

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

Usage:

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.1.0.tar.gz (5.9 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.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyqtpaint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 318ad32d4858db75cd18c46e220534dcb743046a7872b400ddd6625912bd2e11
MD5 0e221b5b8f0b2b37a9021cca5bf85e6c
BLAKE2b-256 7c33ba3e9a40ae9ccf216bbfb10ec532e7c85e2b96661daf441241d37205df21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqtpaint-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 daf52af31a5e08ffede09bfdf9471f60b45a25611857b11c2a25053f5ef0c734
MD5 0cc495000a8a755b76b2d72d61a21c33
BLAKE2b-256 ea892d9e1ebaeb8ef22a70a7676fe74757ae0d0dcc0f3358ba3dfabb597b8b63

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