WordSearch is a Python class for creating wordsearch puzzles.
Installation:
The PyValem package can be installed either from PyPI using pip
python3 -m pip install python-wordsearch
or from the source by running (one of the two) from the project source directory.
# either
python setup.py install
# or
python3 -m pip install .
Examples:
Creating a Word Search Puzzle
A WordSearch object can be created with the following arguments to generate a word-search:
nrows, ncols: the dimensions of the word-search grid
wordlist or wordlist_filename: a list of words or the filename of a text file containing the words (one per line).
output_filestem: forms the base of the filename to use for the output SVG image. Defaults to 'wordsearch', which will produced files called 'wordsearch-search.svg' and 'wordsearch-search-solution.svg'.
mask (optional): defines the shape of the word-search (None, 'circle' or 'squares').
allow_backwards_words: defaults to False.
>>> from wordsearch import WordSearch
>>> wordsearch = WordSearch(
...: 15,
...: 15,
...: [
...: "BOXER",
...: "DASCHUND",
...: "AIREDALE",
...: "BORZOI",
...: "LABRADOR",
...: "CHIHUAHUA",
...: "GREYHOUND",
...: "POMERANIAN",
...: ],
...: mask="circle",
...: output_filestem="dog-search",
...: allow_backwards_words=True,
...: )
>>> wordsearch.make()
(True, 'Fitted the words in 1 attempt(s)')
>>> print(wordsearch.wordsearch_text)
C K I Z H
L L H E S Z R I L
R E F I L H W Y D Y R
S W C X H A J M W G R P G
P Q M R U D P Y M M O I R
F D D E P A E A B J M D D E W
A I X C O H R I L E O P A Y Y
P O D G B U I N R L D D S H B
B Y V A A A A A C A U A C O U
I O Z R O B N K A B B Q H U E
Z V H C I Q U P R D D U N
O M A A K U Q G A D Y N D
I N L C E F W D T I D
L L X X G W O A I
M J Z C R
POMERANIAN
CHIHUAHUA
GREYHOUND
DASCHUND
AIREDALE
LABRADOR
BORZOI
BOXER
Output to an SVG file is also possible:
>>> wordsearch.write_wordsearch_and_solution_svg()
which produces the image:
Metadata
Release files for python-wordsearch 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-wordsearch-1.0.1.tar.gz | 19.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_wordsearch-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.4 kB
Release files / python-wordsearch-1.0.1.tar.gz
| Download URL | python-wordsearch-1.0.1.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff6f71e862888bb21670c74a3b304701f76be979d46bb9c30c3634fd706e131e
|
|
BLAKE2b-256 checksum How to use checksums |
1eb982cdb46ccf3df5790602c3e447c2ad87e71c895957620d11e237a05c69fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / python_wordsearch-1.0.1-py3-none-any.whl
| Download URL | python_wordsearch-1.0.1-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18bde0b4b692180206608b19251460f27d283fd6d68aa6c0f0b91a8f933ead40
|
|
BLAKE2b-256 checksum How to use checksums |
c3603fbe76e2af6b0291610b2ecba70012210165c0e276611c8143ccc91bbace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|