Skip to main content

PySide6DOM v0.4.9

Bring the simplicity of the Web DOM to Python PySide6 Desktop Applications.

Installation

pip install pyside6dom

Upgrade:

pip install --upgrade pyside6dom

PySide6DOM Tutorials:

Tutorials


PySide6DOM bridges the gap between web development and systems programming. It wraps the raw power of the PySide6 (C++/Qt) rendering engine inside the familiar, intuitive Document Object Model (DOM) paradigm used by JavaScript and HTML.

If you know how to build a web page using createElement (ce), getElementById (ge), and append (ba), you already know how to build high-performance, standalone Python desktop applications.


Notice how it looks very similar to JavaScript DOM scripting!

# styling_text.py

from pyside6dom import *

init_window('Our App', 700, 600)

ourTitle = ce('text')
ourTitle.textContent = 'Hi Everyone'
ourTitle.style.fontFamily = 'Arial'
ourTitle.style.fontSize = '70px'
ourTitle.style.fontWeight = 'bold'
ourTitle.style.color = 'rgb(255, 255, 255)'
ba(ourTitle)

run_app()

🌟 Why Use PySide6DOM?

  • Zero HTML Parsing: This is not a web view or a browser wrapper. It generates native C++/Qt desktop widgets using Python, ensuring maximum performance.
  • Familiar Syntax: Uses lightweight helper functions modeled directly after the web DOM (ce() for create element, ge() for get element, ba() for body append).
  • Rapid Prototyping: Build user interfaces in seconds without getting bogged down in complex object-oriented boilerplate.
  • Educational Bridge: The perfect stepping stone for web developers transitioning into local hardware control, computer vision, and systems engineering.

🚀 The Code: Web Logic meets Python Power

Look how clean and intuitive building a native desktop app becomes. No complex classes, no confusing layout managers - just straightforward DOM logic.

# input_upper.py

from pyside6dom import *

init_window('Our App', 700, 600)

our_greeting = ce('text')
our_greeting.textContent = 'Hi Everyone'
our_greeting.style.fontFamily = 'Arial'
our_greeting.style.fontSize = '70px'
our_greeting.style.fontWeight = 'bold'
our_greeting.style.color = 'rgb(255, 255, 255)'
ba(our_greeting)

word_input = ce('input')
word_input.placeholder = 'Enter Name'
def handle_input():
    ge('output_txt').textContent = word_input.value.upper()
word_input.oninput = handle_input
ba(word_input)

output_txt = ce('text')
output_txt.id = 'output_txt'
output_txt.textContent = 'Output'
ba(output_txt)

run_app()

📖 API Reference

Core Engine Functions

  • init_window(title, width, height, icon): Initializes the main window and layout with icon for title bar and tray.
  • run_app(): Starts the Qt application event loop.
  • ce(tag): (document.createElement) Creates a native widget wrapped as a DOMElement.
  • ge(id): (document.getElementById) Retrieves a previously created element by its .id.
  • ba(child, parent=None): (appendChild) Appends an element to the main window or a parent container.
  • set_theme(css) or set_global_style(css): Applies a universal CSS stylesheet to the entire application.
  • setInterval(callback, ms): Repeatedly runs a callback at the specified millisecond interval.
  • cl(*args) or console.log(*args): Logs output to the console, mirroring web debugging.

Supported Tags & Widget Bindings

  • text / p / h1 / span: Text labels.
    • Properties: .textContent, .innerHTML
  • button: Standard push button.
    • Properties: .textContent, .onclick
  • input: Single-line text input field.
    • Properties: .value, .placeholder, .oninput
  • textarea: Multi-line text edit area.
    • Properties: .value, .placeholder, .oninput
  • slider: Numeric range slider.
    • Properties: .value, .oninput
  • checkbox: Toggle checkbox.
    • Properties: .checked, .textContent, .oninput
  • select / dropdown: Dropdown selection menu.
    • Properties: .options (list), .value (selected text), .oninput
  • img: Image display element with Aspect Ratio
    • Properties: .src (file path)
  • video: Video display element with Aspect Ratio
  • div: Standard container widget for grouping elements.
  • scroll_div: Scrollable container area for overflow content.
  • CSS keywords: div, text, button, scroll_div, select, option,

Universal Properties & Methods

All elements support the following properties:

  • .id: Unique string identifier for retrieval with ge(id).
  • .style("css_string"): Inline CSS styling targeting the specific element.

We can type:
element.style.color = 'rgb(0, 255, 255)'


🎨 CSS Styling & Tag Mapping

The engine translates standard HTML tags into PySide6 widgets behind the scenes. This allows you to write clean, web-style CSS for your desktop applications.

(Note: If you are already a PySide6 veteran, standard Qt class names like QPushButton will still work perfectly!)

Layout & Containers

  • body ➔ QMainWindow (and central widget)
  • div ➔ QWidget
  • scroll_div ➔ QScrollArea

Text & Media

  • text, h1, p, span, img ➔ QLabel

Interactive Controls

  • button ➔ QPushButton
  • input ➔ QLineEdit
  • textarea ➔ QPlainTextEdit
  • checkbox ➔ QCheckBox
  • slider ➔ QSlider
  • select (or dropdown) ➔ QComboBox
  • select option ➔ QComboBox QAbstractItemView (The dropdown list items)

CSS Properties

  • font-color ➔ color

pyside6dom Created by Christopher Andrew Topalian

College of Scripting Music & Science

Disclaimer: This is an independent open-source educational project. "PySide" and "Qt" are registered trademarks of The Qt Company. This project is not affiliated with, endorsed by, or sponsored by The Qt Company.


Easy Example:

# easy_example_with_set_theme.py

from pyside6dom import *

set_theme("""
    body {
        background-color: rgb(30, 30, 30);
    }
    button {
        background-color: rgb(0, 0, 0);
        color: cyan;
        /* we write 1px before solid */
        border: 1px solid rgb(255, 255, 255);
        border-radius: 5px;
    }
    button:hover {
        background-color: #555;
        border-color: rgb(0, 255, 255);
    }
    button:pressed {
        font-weight: bold;
    }
    input {
        border: 1px solid white;
    }
""")

init_window("Our App", 600, 400)

welcomeMessage = ce('text')
welcomeMessage.textContent = 'Welcome'
ba(welcomeMessage)

sayHiBtn = ce('button')
sayHiBtn.textContent = 'Hi'
def handle_click():
    welcomeMessage.textContent = 'Hi'
sayHiBtn.onclick = handle_click
ba(sayHiBtn)

sayHowdyBtn = ce('button')
sayHowdyBtn.textContent = 'Howdy'
def handle_click():
    welcomeMessage.textContent = 'Howdy'
sayHowdyBtn.onclick = handle_click
ba(sayHowdyBtn)

sayThisBtn = ce('button')
sayThisBtn.textContent = 'Custom'
def handle_click(message):
    welcomeMessage.textContent = message
sayThisBtn.onclick = lambda: handle_click('Hey Now')
ba(sayThisBtn)

run_app()

COMMON COMMANDS:

Install:

pip install pyside6dom

Upgrade:

pip install --upgrade pyside6dom


GitHub: https://github.com/ChristopherAndrewTopalian/pyside6dom

PyPi: https://pypi.org/project/pyside6dom/

PyPi_Stats: https://pypistats.org/packages/pyside6dom


How to Download the GitHub Repository

  1. Click the green Code Button on the GitHub page
  2. Choose Download ZIP
  3. Save the Zip File
  4. Extract All

Hapy Scripting :-)


//----//

// Dedicated to God the Father

// Copyright (c) 2026-present Christopher Andrew Topalian

// Apache License Version 2.0, January 2004 http://www.apache.org/licenses/

// GitHub: https://github.com/ChristopherAndrewTopalian/pyside6dom

// PyPI: https://pypi.org/project/pyside6dom/

// https://github.com/ChristopherAndrewTopalian

// https://github.com/ChristopherTopalian

// https://sites.google.com/view/CollegeOfScripting

Release files for pyside6dom 0.4.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 pyside6dom 0.4.9
File Size Uploaded
pyside6dom-0.4.9.tar.gz 17.1 kB Details

Built distribution (wheel)

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

Total release size: 31.8 kB

Release files / pyside6dom-0.4.9.tar.gz

Download URL pyside6dom-0.4.9.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c72727ac735b382a5400ddfb2f24f554c60582af54cc70a40d4e619d02373110
BLAKE2b-256 checksum
How to use checksums
f03a393cb3789e4a1bffbed31f63b6993a70d1449072a8f077f4eab41022194d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Release files / pyside6dom-0.4.9-py3-none-any.whl

Download URL pyside6dom-0.4.9-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ea010c19021030ed3e3088daac7df0978c2d18946c98c2d72d4adc4f033fde7
BLAKE2b-256 checksum
How to use checksums
fac57a314d71ce996dedfc5369593d24c0b816a36d8ca91fc975485bedcc5827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Release history Release notifications | RSS feed

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

This release

0.4.9 This release

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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