A package for creating word searches
Project description
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:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_wordsearch-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18bde0b4b692180206608b19251460f27d283fd6d68aa6c0f0b91a8f933ead40 |
|
MD5 | 38c3619b0c4d1f8cf7719398e7a4269b |
|
BLAKE2b-256 | c3603fbe76e2af6b0291610b2ecba70012210165c0e276611c8143ccc91bbace |