{"id":14982608,"url":"https://github.com/muziing/pyside6-code-tutorial","last_synced_at":"2025-05-14T18:02:00.596Z","repository":{"id":38180040,"uuid":"498234553","full_name":"muziing/PySide6-Code-Tutorial","owner":"muziing","description":"可能是最好的PySide6中文教程！用代码实例讲解PySide6，附优质Demos、图标库、QSS皮肤、相关文章等分享！","archived":false,"fork":false,"pushed_at":"2025-03-03T20:50:32.000Z","size":5621,"stargazers_count":1330,"open_issues_count":4,"forks_count":153,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-06T08:04:59.820Z","etag":null,"topics":["pyside6","python","qt6","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muziing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2022-05-31T07:38:23.000Z","updated_at":"2025-04-04T16:41:23.000Z","dependencies_parsed_at":"2023-12-25T21:38:41.353Z","dependency_job_id":"e65232e0-5706-4cb2-829c-3d613c8265ff","html_url":"https://github.com/muziing/PySide6-Code-Tutorial","commit_stats":{"total_commits":209,"total_committers":4,"mean_commits":52.25,"dds":0.02392344497607657,"last_synced_commit":"1faa029b1fe9c082d4ae7447a2e47d1e0e0815de"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muziing%2FPySide6-Code-Tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muziing%2FPySide6-Code-Tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muziing%2FPySide6-Code-Tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muziing%2FPySide6-Code-Tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muziing","download_url":"https://codeload.github.com/muziing/PySide6-Code-Tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248709172,"owners_count":21149140,"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":["pyside6","python","qt6","tutorial"],"created_at":"2024-09-24T14:05:44.120Z","updated_at":"2025-04-13T11:40:02.148Z","avatar_url":"https://github.com/muziing.png","language":"Python","readme":"\u003cimg src=\"./Resources/Icons/Qt_for_Python_128px.png\" alt=\"logo\" height=\"128\" align=\"right\" /\u003e\n\n# PySide6 代码式教程\n\n用代码实例讲解 PySide6 ！\n\n![GitHub Repo stars](https://img.shields.io/github/stars/muziing/PySide6-Code-Tutorial)\n![License](https://img.shields.io/github/license/muziing/PySide6-Code-Tutorial)\n![GitHub Last Commit](https://img.shields.io/github/last-commit/muziing/PySide6-Code-Tutorial)\n[![PySide Version](https://img.shields.io/badge/PySide-6.6-blue)](https://doc.qt.io/qtforpython/index.html)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)\n\n## 简介\n\n本教程旨在通过可以直接在本地机器上运行的脚本代码讲解介绍 **PySide6**。\n\n- 代码中以详细的注释作为讲解\n- 每个模块（`.py`文件）都可独立运行，演示了各种控件的各种功能、属性、作用\n- 在自己的机器上实际运行一下，仔细观察一下每个属性值的改变会怎样影响控件的外观行为，可能比静态的文档教程更有效\n- 前身为 GitHub 热度最高的中文 PyQt5 教程 [PyQt-Practice](https://github.com/muziing/PyQt_practice)，目前已有 ![PyQt-Practice Stars](https://img.shields.io/github/stars/muziing/PyQt_practice.svg) 个 Stars\n- 相比 [PyQt-Practice](https://github.com/muziing/PyQt_practice)，改进了项目目录结构，增加了部分内容，更加清晰丰富\n- 使用最新的 Python 与 PySide 版本（目前为`3.11`与`6.6`）\n\n希望本项目对你我的 Python-GUI 学习之旅有所帮助。\n\n![思维导图目录](./Resources/Images/TOC-MindMap.png)\n\n[访问在线思维导图目录](https://www.processon.com/view/link/63034ce01efad47d1247911e)\n\n## 如何使用\n\n### 一、获取源代码\n\n1. Star 本仓库\n2. 通过以下方法之一获取源码\n   - 克隆仓库（推荐）：`git clone https://github.com/muziing/PySide6-Code-Tutorial.git`\n   - 下载 zip：\u003chttps://github.com/muziing/PySide6-Code-Tutorial/archive/refs/heads/main.zip\u003e\n   - 查看 [Releases](https://github.com/muziing/PySide6-Code-Tutorial/releases) 界面，下载最新发布版（文件更小）\n3. 进入项目目录\n\n### 二、配置虚拟环境与安装依赖\n\n**方式 A** ：[venv](https://docs.python.org/zh-cn/3/library/venv.html)（简单易用，推荐）\n\n1. 确保 Python 版本与 [pyproject.toml](./pyproject.toml) 中要求的一致\n2. 创建虚拟环境\n   - Windows: `python -m venv --upgrade-deps venv`\n   - Linux/macOS: `python3 -m venv --upgrade-deps venv`\n3. 激活虚拟环境\n   - Windows: `venv\\Scripts\\activate`\n   - Linux/macOS: `. venv/bin/activate`\n4. 安装依赖：`pip install -r requirements.txt`\n\n**方式 B** ：[Poetry](https://python-poetry.org/)\n\n1. 确保 Python 版本与 [pyproject.toml](./pyproject.toml) 中要求的一致\n2. 按[官方文档](https://python-poetry.org/docs/#installation)提示安装 Poetry\n3. 创建虚拟环境：`poetry env use /full/path/to/python`（注意替换路径）\n4. 安装依赖：`poetry install --no-root --only main`\n5. 使用该虚拟环境： `poetry shell`（或在 PyCharm 等 IDE 中配置）\n\n\u003e 更多 Poetry 使用方法信息，请参阅其[官方文档](https://python-poetry.org/docs/)。\n\n**方式 C** ：其他包管理工具\n\n1. 使用你喜欢的其他工具创建虚拟环境，如 [Pipenv](https://pipenv.pypa.io/)、[Conda](https://www.anaconda.com/) 等\n2. 安装 [requirements.txt](./requirements.txt) 中描述的依赖项\n\n### 三、运行与学习\n\n1. 打开感兴趣的 `.py` 模块\n2. 阅读文档部分\n3. 运行，观察该界面/控件效果\n4. 阅读代码中的注释，可根据提示对特定行进行「注释/取消注释」\n5. 再次运行该模块，观察变化\n\n## 项目结构\n\n### 主要\n\n| 目录/文件                                                           | 描述                                  |\n|-----------------------------------------------------------------|-------------------------------------|\n| [00. PySide Learning - 各种学习资源](./00-PySideLearning-文章教程Demo等资源) | 文章、教程、Demo等资源                       |\n| [01. HelloWorld - PySide 基本结构](./01-HelloWorld-基本结构)            | 新手上路，PySide6 程序的基本结构                |\n| [02. QtCore - 非GUI的核心功能](./02-QtCore-非GUI的核心功能)                 | 元对象系统、「信号与槽」通信机制等                   |\n| [03. QtWidgets - 常用控件](./03-QtWidgets-常用控件)                     | 按钮、输入框、文本编辑器、下拉菜单、滚动条等等常用控件的功能、用法   |\n| [04. QtGui - 使用GUI功能扩展QtCore](./04-QtGui-使用GUI功能扩展QtCore)       | 位图、字体、颜色、键盘快捷键等、事件（暂未完成）            |\n| [05. QtWidgets - 进阶话题](./05-QtWidgets-进阶话题)                     | 布局管理器、QSS样式、主窗口控件等                  |\n| [06. Model/View - 模型与视图、数据库](./06-ModelView-模型与视图、数据库)          | 模型与视图、与数据库交互                        |\n| [07. Packaging - 静态资源编译、打包](./07-Packaging-资源管理与打包)             | 将应用程序打包为 `exe`、将静态资源编译至二进制 `qrc` 文件 |\n| ……                                                              | ……                                  |\n\n### 其他\n\n| 目录/文件                                          | 描述                |\n|------------------------------------------------|-------------------|\n| [requirements.txt](./requirements.txt)         | 依赖项，运行本项目必备       |\n| [pyproject.toml](./pyproject.toml)             | 项目配置文件            |\n| [poetry.lock](./poetry.lock)                   | Poetry 依赖项版本约束文件  |\n| [.gitignore](./.gitignore)                     | git 忽略提交规则        |\n| [LICENSE](./LICENSE)                           | 代码开源许可证           |\n| [LICENSE-Article](./LICENSE-Article)           | 文章许可协议            |\n| [CONTRIBUTING.md](.github/CONTRIBUTING.md)     | 贡献指南              |\n| [Resources](./Resources)                       | 图片等静态资源           |\n\n## 贡献\n\nPySide6 Code Tutorial 是一个开源项目，非常期待以及感谢你的参与贡献。共同完善这个项目，让它帮助到更多人。\n\n贡献的方式有很多种，并不一定都需要高超的编程能力：\n\n- 指出错别字、错误拼写等\n- 提议加入新功能、新模块等\n- 参与某个 QWidget 控件相关代码编写\n- 投稿优质 PySide6 相关博文、QSS 样式等\n- ……\n\n关于为本项目提交贡献的详细信息，请查阅[贡献指南](.github/CONTRIBUTING.md)。\n\n## 开源许可与分享约定\n\n### 代码\n\n本仓库中的代码使用 [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) 许可开源。对本项目的复制、分发和修改，请严格遵守该协议。\n\n为便于使用者在自己的项目或博客文章中使用本仓库的代码片段，作以下分享约定：\n\n| 类型           | 代码行数   | 来自模块           | 使用要求                                                                      |\n|--------------|--------|----------------|---------------------------------------------------------------------------|\n| 少量代码         | \u003c 100  | 单个 `.py` 模块    | 直接复制使用即可，无需声明                                                             |\n| 短片段          | \u003c 500  | 6 个以内 `.py` 模块 | 在代码首行添加 `# 来自 github.com/muziing/PySide6-Code-Tutorial` 注释；如对代码有修改则必须明确声明 |\n| 基于本项目修改衍生的项目 | \\\u003e 500 | 多个 `.py` 模块    | 严格遵守 GPLv3 相关要求                                                           |\n\n### 文章\n\n本仓库中的文章，凡未注明作者的，均为 [muzing](https://github.com/muziing) 所著，使用 [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) 协议发布。\n\n## 打赏\n\n如果本项目对你有帮助，可以请[主要作者/维护者](https://muzing.top/about/)喝一杯冰可乐 :beer:。\n\n![微信赞赏码](./Resources/Images/muzing-WeChat-Collection.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuziing%2Fpyside6-code-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuziing%2Fpyside6-code-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuziing%2Fpyside6-code-tutorial/lists"}