Skip to main content

QShader - Shaders support for 2D PyQt Games.

Project description

Powerful shading support for PyQt5..

https://github.com/xzripper/QShader/blob/main/shaders.gif?raw=true
#thread QTimer 10

#pre_define hue 0

#import PyQt5.QtGui QColor

#begin_shader
Color1 = QColor.fromHsv(hue, 50, 200)
Color2 = QColor.fromHsv((hue + 30) % 360, 50, 220)
Color3 = QColor.fromHsv((hue + 60) % 360, 50, 240)

if @@UNDER_MOUSE:
    Gradient = f"qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 {Color1.name()}, stop:{@@MOUSE_POSITION_WIDGET.x() / $$parent.width()} {Color2.name()}, stop:1 {Color3.name()})"

else:
    Gradient = f"qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 {Color1.name()}, stop:0.5 {Color2.name()}, stop:1 {Color3.name()})"

$$style(f"background: {Gradient}; color: white; border: 0px solid; border-radius: 1px; font-size: 18px; padding: 15px;")

$$effect(BloomEffect, 100, QColor.fromRgb(Color1.red(), Color2.green(), Color3.blue(), @@RGB_MAX))

hue = (hue + 1) % 360
#end_shader
#thread QTimer 10

#pre_define hue 0

#import PyQt5.QtGui QColor

#begin_shader
color = QColor.fromHsv(hue, @@RGB_MAX, @@RGB_MAX)

$$style(f'background-color: {color.name()}; color: black; border: 0px; font-size: 20px; padding: 30px;')

$$effect(BloomEffect, 250, color)

$$parent.setText(color.name())

hue = (hue + (2 if @@UNDER_MOUSE else 1)) % 360
#end_shader

WARNING: QShader is in ALPHA state, please be patient and report all bugs.

QShader Documentation. QTS Documentation.


QShader V1.0.0-ALPHA.

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

qshader-1.1.0.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file qshader-1.1.0.tar.gz.

File metadata

  • Download URL: qshader-1.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.9

File hashes

Hashes for qshader-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cc77f072a90403bff0a0cf442a4f1329ef28c488cc1a9da25c22442ee6cc5c3b
MD5 312511080e0b34902bc688dc61f409b7
BLAKE2b-256 26dee6399c28a6d352ab03c3fef86c730488f8c3ef2ab414964a3951070c4b02

See more details on using hashes here.

Supported by

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