Skip to main content

Python Desktop Application Development

Project description

QtMui Framework Introduction QtMui is a powerful Python framework built on top of PySide6, designed to bring the full power of React and Material-UI (MUI) to desktop application development. Inspired by the component-based architecture and styling flexibility of MUI (https://mui.com), QtMui provides a comprehensive suite of UI components, hooks, state management, and form handling utilities. It enables developers to create modern, responsive, and cross-platform desktop applications with a declarative, React-like API. With official support at https://qtmui.com, QtMui is the go-to solution for building scalable, professional-grade desktop UIs. Features

Comprehensive Component Library: A complete set of Material-UI-inspired components, including Box, Button, TextField, Grid, Typography, and more, designed for flexibility and ease of use. React-Inspired Hooks: Includes hooks like useState, useEffect, useResponsive, and others to manage state, side effects, and responsive layouts in a declarative manner. State Management with Redux: Integrated Redux support for centralized, predictable state management across complex applications. Form Handling and Validation: Robust form management with hookform and formvalidate, enabling seamless form creation and validation. Responsive Design: Built-in utilities like useResponsive and flexible layout components for creating adaptive UIs across different screen sizes. Customizable Styling: Supports inline sx prop styling (MUI-like) and QSS (Qt Style Sheets) for advanced, themeable designs. Type-Safe Development: Leverages Python’s type hints and optional static type checking for robust, maintainable codebases. Cross-Platform: Powered by PySide6, ensuring compatibility with Windows, macOS, and Linux. Theming Support: Create and apply custom themes to maintain consistent styling across your application.

Installation To get started with QtMui, ensure you have Python 3.8+ installed. Install QtMui and its dependencies using pip:

pip install qtmui

Getting Started Below is an example demonstrating QtMui’s component-based architecture, hooks, and Redux integration: import sys from qtmui.material.qtmui_app import QtMuiApp from qtmui.material.window import QtMuiWindow from qtmui.material.box import Box from qtmui.material.button import Button from qtmui.hooks import useState from qtmui.redux import create_store, useSelector, useDispatch

Define a simple Redux store

def counter_reducer(state=0, action=None): if action["type"] == "INCREMENT": return state + 1 return state

store = create_store(counter_reducer)

class MainWindow(QtMuiWindow): def init(self): super().init() self.setCentralWidget(CounterApp())

class CounterApp: def init(self): self.count, self.set_count = useState(0) self.dispatch = useDispatch()

def render(self):
    count = useSelector(lambda state: state)
    return Box(
        direction="column",
        spacing=10,
        sx={"padding": 20},
        children=[
            Box(sx={"font-size": 20}, children=f"Count: {count}"),
            Button(
                children="Increment",
                on_click=lambda: self.dispatch({"type": "INCREMENT"}),
                sx={"background-color": "blue", "color": "white"}
            )
        ]
    )

if name == "main": app = QtMuiApp(sys.argv) window = MainWindow() window.show() sys.exit(app.exec())

This example showcases a counter app using useState, Redux, and the Box and Button components, demonstrating QtMui’s declarative and reactive capabilities. Key Components QtMui offers a full suite of components inspired by Material-UI, including but not limited to:

Box: A flexible container for layout management with support for direction, spacing, and custom styling. Button: A customizable button with variants, colors, and event handling. TextField: An input component with form validation support. Grid: A responsive grid system for complex layouts. Typography: A component for styled text with customizable fonts and sizes.

Explore the full component library at https://qtmui.com/docs/components. Hooks QtMui provides a rich set of hooks to manage state, side effects, and responsive behavior:

useState: Manage local component state. useEffect: Handle side effects like data fetching or DOM updates. useResponsive: Access screen size and device information for responsive design. useSelector/useDispatch: Integrate with Redux for global state management.

Learn more about hooks at https://qtmui.com/docs/hooks. Form Handling QtMui’s hookform and formvalidate utilities simplify form creation and validation: from qtmui.material.hookform import useForm from qtmui.material.text_field import TextField

def FormExample(): form = useForm({"name": ""}, {"name": {"required": True, "minLength": 3}}) return Box( children=[ TextField( name="name", label="Name", form=form, sx={"width": 200} ), Button( children="Submit", on_click=form.submit, sx={"margin-top": 10} ) ] )

This example demonstrates a simple form with validation, powered by hookform. Styling and Theming QtMui supports both inline sx styling and global QSS theming. Example of inline styling: Box(sx={"background-color": "blue", "border-radius": 5, "padding": 10})

For global theming, define a QSS function: from qtmui.material.styles.create_theme.theme_reducer import ThemeState

def theme_styles(_theme) -> dict: theme: ThemeState = _theme return { "PyBox": { "styles": { "root": {"backgroundColor": "transparent", "color": theme.palette.text.primary} } } }

Visit https://qtmui.com/docs/styling for detailed theming guides. Redux Integration QtMui seamlessly integrates with Redux for global state management. Define reducers and use hooks like useSelector and useDispatch to interact with the store, as shown in the Getting Started example. Contributing We welcome contributions to QtMui! To contribute:

Fork the repository at https://github.com/qtmui/qtmui. Create a new branch for your feature or bug fix. Submit a pull request with a clear description of your changes.

Please adhere to our coding standards and include tests where applicable. Check our contribution guidelines at https://qtmui.com/docs/contributing. License QtMui is licensed under the MIT License. See the LICENSE file for details. Contact For support, feedback, or inquiries, visit https://qtmui.com/support or file an issue at https://github.com/qtmui/qtmui/issues. Join our community discussions to connect with other developers. Learn More Explore the full documentation, tutorials, and API reference at https://qtmui.com to unlock the full potential of QtMui.

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

qtmui-0.0.27.tar.gz (22.7 MB view details)

Uploaded Source

Built Distribution

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

qtmui-0.0.27-py3-none-any.whl (23.3 MB view details)

Uploaded Python 3

File details

Details for the file qtmui-0.0.27.tar.gz.

File metadata

  • Download URL: qtmui-0.0.27.tar.gz
  • Upload date:
  • Size: 22.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for qtmui-0.0.27.tar.gz
Algorithm Hash digest
SHA256 68b5ddc2de7f4ba9147ec47571dd3490c384adce6827233ee4490634d7af9d81
MD5 ecb96838f3614cdd3d52bbece825767e
BLAKE2b-256 14f9557823e9c27b6fbd9997f6b05b914734b057c7e444296294eb0f8a9f5589

See more details on using hashes here.

File details

Details for the file qtmui-0.0.27-py3-none-any.whl.

File metadata

  • Download URL: qtmui-0.0.27-py3-none-any.whl
  • Upload date:
  • Size: 23.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for qtmui-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 ccd49078e60890a4733a746b49a70f8a78cac74534ee420da7f3f38b318fe265
MD5 d888acefbea34da1b7c92a4c49d734c3
BLAKE2b-256 f667ab041350f90dd470e5e687acd74ba2edcd5e2e3c496b5b2f92c6217c77fb

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