-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a method to add text to the top of the code #9
base: master
Are you sure you want to change the base?
Conversation
added a font file from: https://fonts.google.com/specimen/Roboto+Flex?query=Roboto changed main() to give the option to have text or not by changing commented lines text is only added when there is a font file specified renamed sample aztec code and added a second sample
@@ -544,7 +544,7 @@ class AztecCode(object): | |||
Aztec code generator. | |||
""" | |||
|
|||
def __init__(self, data, size=None, compact=None): | |||
def __init__(self, data, fontfile=None, size=None, compact=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add fontfile to docstring.
aztec_code_generator.py
Outdated
@@ -594,6 +595,13 @@ def save(self, filename, module_size=1): | |||
(x * module_size, y * module_size, | |||
x * module_size + module_size, y * module_size + module_size), | |||
fill=(0, 0, 0) if self.matrix[y][x] == '#' else (255, 255, 255)) | |||
if self.my_font != None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use is not None:
aztec_code_generator.py
Outdated
@@ -840,16 +848,72 @@ def __encode_data(self): | |||
data_cw_count = self.__add_data(self.data) | |||
self.__add_mode_info(data_cw_count) | |||
|
|||
def add_text(self, img_obj, text, module_size = 4): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format the code and add arguments to docstring.
README.md
Outdated
#to add text: | ||
aztec_code = AztecCode(data,fontfile='path/to/your/font.ttf') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format this lines according to pep8.
fixed docstring fixed line 600 - if self.my_font is not None: fixed formatting in README.md
added a font file from: https://fonts.google.com/specimen/Roboto+Flex?query=Roboto
changed main() to give the option to have text or not by changing commented lines
text is only added when there is a font file specified
renamed sample Aztec code and added a second sample