Skip to main content

PyGraphicUI enhances PyQt6 GUI development with simplified widget creation, intuitive layout management, dynamic time-based widgets, and an object-oriented approach to stylesheets, reducing boilerplate and improving code readability.

Project description

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.

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

pygraphicui-1.5.9.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

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

pygraphicui-1.5.9-py3-none-any.whl (121.4 kB view details)

Uploaded Python 3

File details

Details for the file pygraphicui-1.5.9.tar.gz.

File metadata

  • Download URL: pygraphicui-1.5.9.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pygraphicui-1.5.9.tar.gz
Algorithm Hash digest
SHA256 1f46fb9c2ac4538cbf6e0d6c10e35e7d2f190221bf1f0007ac93d7db38ebc8a0
MD5 547944c2edee8e44ea8ef405dd7af1fd
BLAKE2b-256 fa67f45c482e3cc5bb181899597256e77a6c6a5b8fd8eabd45c261b9a8a1f2ab

See more details on using hashes here.

File details

Details for the file pygraphicui-1.5.9-py3-none-any.whl.

File metadata

  • Download URL: pygraphicui-1.5.9-py3-none-any.whl
  • Upload date:
  • Size: 121.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pygraphicui-1.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ec7e46fe399d3a4714a08ae8bca5fb44a3dc541158c39d71234b5aa022dd3c76
MD5 b0d7b2426d8a5cfb62df28925c4c9b93
BLAKE2b-256 10b2ffb3ffcee467bb7af207b54c8a0dcff797bc71bc78214dd322f5b2ceebea

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