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.1.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.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyqtpaint-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f9e6c9ebd18b7132da7960cc1b8226da3f7c50e5f6965e0e6635d0084be1e294
MD5 896312c6c0db6f9a542663c0d44bf347
BLAKE2b-256 2a96948c7ed38ba263da06d7f28aa9d5cb8781bfd060dfb8ba98f7bb0b085ba7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqtpaint-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14a041e08694d0368a0aaa7c45da0bce8b93f9cd1dbd8347220bf8b7eef6f862
MD5 b77cc90550462faf92faf7d9429e358f
BLAKE2b-256 c022890fe48007dce739e2fe0d9c1221176ae8b14cc1856f4ff54cd97bc36848

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