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 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:

pip install PyGraphicUI

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

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(point_size=32)
                ),
                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()

    app.aboutToQuit.connect(main_functions.close_program)
    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.3.7.tar.gz (72.7 kB view details)

Uploaded Source

Built Distribution

PyGraphicUI-1.3.7-py3-none-any.whl (115.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygraphicui-1.3.7.tar.gz
  • Upload date:
  • Size: 72.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for pygraphicui-1.3.7.tar.gz
Algorithm Hash digest
SHA256 38ae5e5d6e0c7345de0e8901525522d639ff7008b8ea1df348154457b7339e85
MD5 019a915c3ec0704d156dc83f62afdb0b
BLAKE2b-256 d3d8b6d24c204d718d8f7eea8595120e9369630d2f2397e365a2da2144b702d5

See more details on using hashes here.

File details

Details for the file PyGraphicUI-1.3.7-py3-none-any.whl.

File metadata

  • Download URL: PyGraphicUI-1.3.7-py3-none-any.whl
  • Upload date:
  • Size: 115.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for PyGraphicUI-1.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed679da8907f5cf51618aea2a06103f3f9b0968f13592ebceb2b65230bb87f2
MD5 f53c2cb16e02d01943f9ff29a000e96f
BLAKE2b-256 c6c6bbd402f2e19836cfa86b2378aae5621eb8588862625c84a1d7eff4b44407

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