Introduce QML-like declarative structure to Python world. Developer writes only pure Python code for QML.

Overview

📝 English documentation is on the way. See Chinese version below.

Declare QtQuick | 声明式 QtQuick 界面库

以全新的方式编写 QtQuick (QML) 界面.

declare-qtquick 支持开发者以纯 Python 语法 + 声明式语法结构编写现代化的界面程序. 它看起来长这样:

from declare_qtquick import Application
from declare_qtquick.widgets import *
from lk_lambdex import lambdex  # pip install lk-lambdex

with Application() as app:

    with Window() as win:
        win.width = 300
        win.height = 400
        win.color = '#F9F0F5'
        win.visible = True
        
        with Rectangle() as rect:
            rect.x = 10
            rect.y = 10
            rect.width = 200
            rect.height = 270
            
            rect.color = 'white'
            rect.radius = 8
    
            rect.width.set_anim(duration=1000)
            rect.height.set_anim(duration=1000)
            
            with Text() as txt:
                txt.anchors.center_in = rect
                txt.text = 'Hello World'
                txt.font.pixel_size = 24
                
            with MouseArea() as area:
                area.anchors.fill = rect
                area.clicked.connect(lambdex('', """
                    rect.width = win.width - 20
                    rect.height = win.height - 20
                """))

    app.start()

运行截图:

FIXME: 下图是示意图, 实际代码仍在开发中.

它等同于以下 QML 代码:

import QtQuick
import QtQuick.Window

Window {
    id: win
    width: 300
    height: 400
    color: '#F9F0F5'
    visible: true
    
    Rectangle {
        id: rect
        x: 10
        y: 10
        width: 200
        height: 270
        
        color: 'white'
        radius: 8
        
        Behavior on width {
            NumberAnimation {
                duration: 1000
            }
        }
        
        Behavior on height {
            NumberAnimation {
                duration: 1000
            }
        }
        
        Text {
            id: txt
            anchors.centerIn: rect
            text: 'Hello World'
            font.pixelSize: 24
        }
        
        MouseArea {
            id: area
            anchors.fill: rect
            onClicked: {
                rect.width = win.width - 20
                rect.height = win.height - 20
            }
        }
    }
}

TODO:More...

You might also like...
Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code.
Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code.

Mini Mini is a web browser application based on the Python PyQt web engine, made in 290 lines of code. The code is written and published as is, so the

Dress up your code with a beautiful graphical user interface !
Dress up your code with a beautiful graphical user interface !

Dresscode Dress up your code with a beautiful graphical user interface ! This project is part of the Pyrustic Ecosystem. Look powered by the cyberpunk

Advanced GUI Calculator with Beautiful UI and Clear Code.
Advanced GUI Calculator with Beautiful UI and Clear Code.

Advanced GUI Calculator with Beautiful UI and Clear Code.

Nonton anime subtitle Indonesia tanpa iklan. Dengan GUI berbasis PyQt5 dan spaghetti code yang sangat tidak terstruktur
Nonton anime subtitle Indonesia tanpa iklan. Dengan GUI berbasis PyQt5 dan spaghetti code yang sangat tidak terstruktur

Nonton anime subtitle Indonesia tanpa iklan. Dengan GUI berbasis PyQt5 dan spaghetti code yang sangat tidak terstruktur

Learn to build a Python Desktop GUI app using pywebview, Python, JavaScript, HTML, & CSS.
Learn to build a Python Desktop GUI app using pywebview, Python, JavaScript, HTML, & CSS.

Python Desktop App Learn how to make a desktop GUI application using Python, JavaScript, HTML, & CSS all thanks to pywebview. pywebview is essentially

Python Screen Recorder using Python

PY-Screen-Recorder Python Screen Recorder using Python Requirement: pip install cv2 pip install pyautogui pip install numpy How to reach me? You can r

Turn (almost) any Python command line program into a full GUI application with one line
Turn (almost) any Python command line program into a full GUI application with one line

Gooey Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line Support this project Table of Contents Gooey Table of conte

pyglet is a cross-platform windowing and multimedia library for Python, for developing games and other visually rich applications.

pyglet pyglet is a cross-platform windowing and multimedia library for Python, intended for developing games and other visually rich applications. It

Launched in 2018 Actively developed and supported. Supports tkinter, Qt, WxPython, Remi (in browser). Create custom layout GUI's simply.  Python 2.7 & 3 Support. 200+ Demo programs & Cookbook for rapid start. Extensive documentation.  Examples using Machine Learning(GUI, OpenCV Integration,  Chatterbot), Floating Desktop Widgets, Matplotlib + Pyplot integration, add GUI to command line scripts, PDF & Image Viewer. For both beginning and advanced programmers .
Owner
likianta
Hola, I'm likia :) Python programmer work in JLSemi Inc.
likianta
A library for building modern declarative desktop applications in WX.

re-wx is a library for building modern declarative desktop applications. It's built as a management layer on top of WXPython, which means you get all the goodness of a mature, native, cross-platform UI kit, wrapped up in a modern, React inspired API.

Chris 115 Dec 24, 2022
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

flexxui 3.1k Dec 29, 2022
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

flexxui 3.1k Jan 8, 2023
A Windows Dock Widget Written In Pure Python

VEПUS A Windows Dock Widget Written In Pure Python What is Venus? Venus is a Dock Widget for your desktops interface. It adds a couple of really cool

Secrets 18 Dec 30, 2022
Transparent & click through tkinter window. WINDOWS ONLY

REQUIREMENTS: WINDOWS ONLY pip install pywin32 NOTES: Will not work on top of a fullscreen application, if you are using this to draw on top of a gam

francis 2 Nov 4, 2022
A little Python library for making simple Electron-like HTML/JS GUI apps

Eel Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries. Ee

Chris Knott 5.4k Jan 7, 2023
A keyboard-driven, vim-like browser based on PyQt5.

qutebrowser is a keyboard-focused browser with a minimal GUI. It’s based on Python and PyQt5 and free software, licensed under the GPL.

qutebrowser 8.4k Jan 1, 2023
An qt asset browser for applications like houdini/nuke/maya/blender

AssetBrowser A qt asset browser for applications like houdini/nuke/maya/blender Currently in development Note: Only houdini plugin available during de

Jonas Sorgenfrei 6 Aug 5, 2022
These are some useful tkinter utilities that i like to personally use.

ntkutils nefs tkinter utilities These are some useful tkinter utilities that i like to personally use. I upload this here because someone might wants

nef 7 Dec 6, 2022
Python code examples on how to create several applications using Dear PyGui.

Python code examples on how to create several applications using Dear PyGui. Includes building and editing a table, as well as visualizing sorting algorithms in a plot.

Alexander H. 7 Sep 15, 2022