added makePdf function, documentation, new version

This commit is contained in:
lukew3
2020-11-20 14:05:48 -05:00
parent be2922a5b0
commit 27082cc299
4 changed files with 21 additions and 2 deletions

View File

@@ -25,6 +25,13 @@ problem, solution = mathgen.addition()
#another way to generate an addition problem using genById()
problem, solution = mathgen.genById(0)
```
## Documentation
`getGenList()` returns a list of all generators in the repository in the format `[id, title, self, funcname]`
`genById(id)` generates a problem, solution set with generator id `id` in the form of a list in the format `[problem, solution]`
`makePdf(id, count)` creates a printable pdf worksheet with `count` problems generated by the generator with id `id`.
## List of Generators

View File

@@ -1,5 +1,6 @@
from .funcs import *
from .__init__ import getGenList
from worksheetgen.wg import Worksheet
genList = getGenList()
@@ -8,3 +9,11 @@ genList = getGenList()
def genById(id):
generator = genList[id][2]
return (generator())
def makePdf(id, count):
generator = genList[id][2]
title = genList[id][1]
ws = Worksheet(title=title)
for i in range(count):
ws.add_problem(generator()[0])
ws.write_pdf()

View File

@@ -1,12 +1,12 @@
from setuptools import setup, find_packages
setup(name='mathgenerator',
version='1.1.5',
version='1.1.6',
description='An open source solution for generating math problems',
url='https://github.com/lukew3/mathgenerator',
author='Luke Weiler',
author_email='lukew25073@gmail.com',
license='MIT',
packages=find_packages(),
install_requires=['sympy', 'numpy', 'scipy'],
install_requires=['sympy', 'numpy', 'scipy', 'worksheetgen'],
entry_points={})

View File

@@ -11,3 +11,6 @@ for item in list:
# print(mathgen.getGenList())
print(mathgen.genById(111))
#Make a pdf with 10 problems of generator id 1
mathgen.makePdf(0, 10)