Beispiel #1
0
def createLabel(ship_date, current_date):
    encoder = DataMatrixEncoder('This is a DataMatrix.')
    encoder.save('./datamatrix_test.png')

    validate_date(ship_date)

    print("This shipment scheduled for: ", ship_date)
    print(encoder.get_ascii())
    print("Above is the shipping label")
    print("Label was printed on: ", current_date)
    def test_against_dmtx(self):
        """Compare the output of this library with that of dmtxwrite"""

        for string in MatrixTest.test_strings:
            encoder = DataMatrixEncoder(string)
            mine = encoder.get_ascii()

            if not os.path.exists(dmtxwrite_path):
                print("%r does not exist, skipping encoding tests" % dmtxwrite_path)
            else:
                fin = os.popen("%s '%s'" % (dmtxwrite_path, string))
                output = ""
                while True:
                    line = fin.readline()
                    if not line:
                        break
                    if line[0] == 'X':
                        output += line
                self.assertEqual(output, mine)
Beispiel #3
0
"""Example code for datamatrix library"""
__revision__ = "$Revision$"

from pystrich.datamatrix import DataMatrixEncoder
import sys
import logging
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))

logging.getLogger("datamatrix").setLevel(logging.DEBUG)
logging.getLogger("datamatrix").addHandler(logging.StreamHandler(sys.stdout))

if __name__ == "__main__":
    encoder = DataMatrixEncoder(sys.argv[1])
    encoder.save("test.png")
    print(encoder.get_ascii())
Beispiel #4
0
"""Example code for datamatrix library"""
__revision__ = "$Revision$"

import pystrich
from pystrich.datamatrix import DataMatrixEncoder
import sys
import logging
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))

logging.getLogger("datamatrix").setLevel(logging.DEBUG)
logging.getLogger("datamatrix").addHandler(logging.StreamHandler(sys.stdout))

if __name__ == "__main__":
    encoder = DataMatrixEncoder(sys.argv[1])
    encoder.save("test.png")
    print(encoder.get_ascii())
Beispiel #5
0
def hello():
    encoder = DataMatrixEncoder('This is a DataMatrix.')
    encoder.save('./datamatrix_test.png')
    print(encoder.get_ascii())
    return "Hello World!"
Beispiel #6
0
# Sample taken from pyStrich GitHub repository
# https://github.com/mmulqueen/pyStrich
from pystrich.datamatrix import DataMatrixEncoder

x = input(" Please enter your name: ")

print("Welcome", x)

encoder = DataMatrixEncoder(x)
encoder.save('./datamatrix_test.png')
print("This is your name as a DataMatrix: ", encoder.get_ascii())