Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

i164j9
Copy link

@i164j9 i164j9 commented Mar 21, 2023

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

i164j9 added 2 commits March 21, 2023 12:24
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):
Copy link
Owner

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.

@@ -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:
Copy link
Owner

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:

@@ -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):
Copy link
Owner

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
Comment on lines 13 to 14
#to add text:
aztec_code = AztecCode(data,fontfile='path/to/your/font.ttf')
Copy link
Owner

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.

i164j9 added 2 commits April 16, 2023 10:27
fixed docstring
fixed line 600 - if self.my_font is not None:
fixed formatting in README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants