{"id":23002932,"url":"https://github.com/likianta/declare-qtquick","last_synced_at":"2025-04-22T20:47:12.264Z","repository":{"id":111982242,"uuid":"422086803","full_name":"likianta/declare-qtquick","owner":"likianta","description":"Introduce QML-like declarative structure to Python world. Developer writes only pure Python code for QML.","archived":false,"fork":false,"pushed_at":"2021-11-14T18:21:39.000Z","size":1139,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T18:41:40.001Z","etag":null,"topics":["declare-gui","pyqt","pyside","python-gui","qml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/likianta.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.zh.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-28T06:15:10.000Z","updated_at":"2023-10-30T05:56:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7de749f-c414-4c0e-9ee9-d05414bd3dd8","html_url":"https://github.com/likianta/declare-qtquick","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likianta%2Fdeclare-qtquick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likianta%2Fdeclare-qtquick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likianta%2Fdeclare-qtquick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likianta%2Fdeclare-qtquick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/likianta","download_url":"https://codeload.github.com/likianta/declare-qtquick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250322640,"owners_count":21411788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["declare-gui","pyqt","pyside","python-gui","qml"],"created_at":"2024-12-15T07:12:39.935Z","updated_at":"2025-04-22T20:47:12.237Z","avatar_url":"https://github.com/likianta.png","language":"Python","readme":"\u003e 📝 English documentation is on the way. See Chinese version below.\n\n# Declare QtQuick | 声明式 QtQuick 界面库\n\n以全新的方式编写 QtQuick (QML) 界面.\n\n`declare-qtquick` 支持开发者以纯 Python 语法 + 声明式语法结构编写现代化的界面程序. 它看起来长这样:\n\n```python\nfrom declare_qtquick import Application\nfrom declare_qtquick.widgets import *\nfrom lk_lambdex import lambdex  # pip install lk-lambdex\n\nwith Application() as app:\n\n    with Window() as win:\n        win.width = 300\n        win.height = 400\n        win.color = '#F9F0F5'\n        win.visible = True\n        \n        with Rectangle() as rect:\n            rect.x = 10\n            rect.y = 10\n            rect.width = 200\n            rect.height = 270\n            \n            rect.color = 'white'\n            rect.radius = 8\n    \n            rect.width.set_anim(duration=1000)\n            rect.height.set_anim(duration=1000)\n            \n            with Text() as txt:\n                txt.anchors.center_in = rect\n                txt.text = 'Hello World'\n                txt.font.pixel_size = 24\n                \n            with MouseArea() as area:\n                area.anchors.fill = rect\n                area.clicked.connect(lambdex('', \"\"\"\n                    rect.width = win.width - 20\n                    rect.height = win.height - 20\n                \"\"\"))\n\n    app.start()\n```\n\n运行截图:\n\n_FIXME: 下图是示意图, 实际代码仍在开发中._\n\n![](.assets/hello-world-anim.gif)\n\n它等同于以下 QML 代码:\n\n```qml\nimport QtQuick\nimport QtQuick.Window\n\nWindow {\n    id: win\n    width: 300\n    height: 400\n    color: '#F9F0F5'\n    visible: true\n    \n    Rectangle {\n        id: rect\n        x: 10\n        y: 10\n        width: 200\n        height: 270\n        \n        color: 'white'\n        radius: 8\n        \n        Behavior on width {\n            NumberAnimation {\n                duration: 1000\n            }\n        }\n        \n        Behavior on height {\n            NumberAnimation {\n                duration: 1000\n            }\n        }\n        \n        Text {\n            id: txt\n            anchors.centerIn: rect\n            text: 'Hello World'\n            font.pixelSize: 24\n        }\n        \n        MouseArea {\n            id: area\n            anchors.fill: rect\n            onClicked: {\n                rect.width = win.width - 20\n                rect.height = win.height - 20\n            }\n        }\n    }\n}\n```\n\n_TODO:More..._\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikianta%2Fdeclare-qtquick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flikianta%2Fdeclare-qtquick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikianta%2Fdeclare-qtquick/lists"}