Skip to main content

PyGraphicUI: Enhanced PyQt6 GUI Development

PyGraphicUI is a Python library built on top of PyQt6 that streamlines the creation of graphical user interfaces. It provides a more intuitive and Pythonic approach to designing and managing PyQt6 widgets and layouts, simplifying complex tasks and reducing boilerplate code.

Key Features:

  • Simplified Widget Initialization: Create PyQt6 widgets with ease using dedicated initialization classes like WidgetInit, SpinBoxInit, LabelInit, and more. These classes provide a cleaner way to set widget properties during creation.
  • Enhanced Layout Management: Easily construct and manage complex layouts with PyVerticalLayout, PyHorizontalLayout, and GridLayout. Add, remove, and access layout items with convenient methods.
  • Dynamic Time-Based Widgets: Incorporate dynamic time display with PyTimer and PyStopWatch, offering customizable formatting and update intervals. Also includes a PyProgressWatcher for tracking progress with estimated time remaining.
  • Powerful Styling with StyleSheets: Create and apply custom stylesheets using a structured and object-oriented approach. BaseStyle, BaseStyleSheet, and specialized style classes for different widgets provide fine-grained control over appearance. Chain styles together for complex selectors.

Installation:

  • With pip:

    pip install PyGraphicUI
    
  • With git:

    pip install git+https://github.com/oddshellnick/PyGraphicUI.git
    

Example Usage:

from PyGraphicUI.PyObjects import PyWidgetWithVerticalLayout, WidgetWithLayoutInit, WidgetInit, LayoutInit, PyPushButton, PushButtonInit
from PyGraphicUI.PyStyleSheets import WidgetStyleSheet, WidgetStyle, Background, Brush, Color, RGB, PushButtonStyleSheet, PushButtonStyle, BorderRadius, BoxLengths, Length, PX, TextColor
from PyGraphicUI.Attributes import ObjectSize, PyFont
from PyQt6.QtWidgets import QApplication, QMainWindow
from PyGraphicUI.Attributes import LinearLayoutItem
from PyQt6.QtCore import Qt, QMetaObject
import sys


class MainProjectWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.main_window = PyWidgetWithVerticalLayout(
                widget_with_layout_init=WidgetWithLayoutInit(
                        widget_init=WidgetInit(
                                parent=self,
                                minimum_size=ObjectSize(800, 600),
                                style_sheet=WidgetStyleSheet(
                                        WidgetStyle(
                                                background=Background(Brush(Color(RGB(45, 45, 45))))
                                        )
                                ).style_sheet
                        ),
                        layout_init=LayoutInit(
                                alignment=Qt.AlignmentFlag.AlignCenter,
                                contents_margins=(10, 10, 10, 10),
                                spacing=10
                        )
                )
        )

        self.button = PyPushButton(
                button_init=PushButtonInit(
                        parent=self.main_window,
                        style_sheet=PushButtonStyleSheet(
                                PushButtonStyle(
                                        background=Background(Brush(Color(RGB(90, 90, 90)))),
                                        border_radius=BorderRadius(BoxLengths(Length(PX(10)))),
                                        text_color=TextColor(Brush(Color(RGB(230, 230, 230))))
                                )
                        ).style_sheet,
                        fixed_size=ObjectSize(width=100, height=50),
                        font=PyFont(size=32, size_type="point")
                ),
                instance="Click"
        )
        self.main_window.add_instance(LinearLayoutItem(self.button))

        self.setCentralWidget(self.main_window)
        QMetaObject.connectSlotsByName(self)
        self.show()

        
def run_program():
    app = QApplication(sys.argv)

    main_window = MainProjectWindow()

    sys.exit(app.exec())

run_program()

Future Notes

PyGraphicUI is actively maintained and will continue to be updated with new widgets, styles, and features. We encourage contributions and welcome suggestions for improvements. Don't hesitate to propose new additions or report any issues you encounter.

Release files for PyGraphicUI 1.5.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyGraphicUI 1.5.9
File Size Uploaded
pygraphicui-1.5.9.tar.gz 74.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyGraphicUI 1.5.9
File Interpreter ABI Platform
pygraphicui-1.5.9-py3-none-any.whl Python 3 none any Details

Total release size: 196.1 kB

Release files / pygraphicui-1.5.9.tar.gz

Download URL pygraphicui-1.5.9.tar.gz
Size 74.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1f46fb9c2ac4538cbf6e0d6c10e35e7d2f190221bf1f0007ac93d7db38ebc8a0
BLAKE2b-256 checksum
How to use checksums
fa67f45c482e3cc5bb181899597256e77a6c6a5b8fd8eabd45c261b9a8a1f2ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pygraphicui-1.5.9-py3-none-any.whl

Download URL pygraphicui-1.5.9-py3-none-any.whl
Size 121.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec7e46fe399d3a4714a08ae8bca5fb44a3dc541158c39d71234b5aa022dd3c76
BLAKE2b-256 checksum
How to use checksums
10b2ffb3ffcee467bb7af207b54c8a0dcff797bc71bc78214dd322f5b2ceebea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

1.5.9 This release

2 release files

1.5.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page