A desktop application built with Python that generates word clouds from text files using a graphical user interface. Users can select any plain text document—supporting both Chinese and English—and optionally provide a mask image to shape the resulting word cloud.
The interface also includes an image viewer for previewing background or mask images from a selected directory.
Dependencies
- Python 3.8+
jieba(for Chinese text segmentation)wordcloudnumpyPillow(for image handling)wxPython(for GUI)
Setup Instructions
Clone the repository:
git clone https://github.com/JimyFengqi/drawWordcloud
cd drawWordcloud
Install dependencies via pip:
pip install -r requirements.txt
Or use the provided shell script:
source install.sh
Launch the application:
python src/daw_gui
Project Configuration with Poetry
The project uses Poetry for dependancy and package management. The entry point is defined as:
[tool.poetry.scripts]
test-package = "src.test:GUI"
To speed up dependency resolution, a domestic PyPI mirror is configured:
[[tool.poetry.source]]
name = "tsinghua"
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
default = true
Code Quality Enforcement
Code formatting and linting are enfocred via pre-commit hooks using:
- Black (line length: 120)
- isort (with Black-compatible settings, grouped imports, and trailing commas)
- flake8
Example configuration:
[tool.black]
line-length = 120
[tool.isort]
profile = "black"
line_length = 120
multi_line_output = 3
include_trailing_comma = true
To bypass hooks during commit:
git commit --no-verify
git push --no-verify