本文整理汇总了Python中Adafruit_Thermal.printBitmap方法的典型用法代码示例。如果您正苦于以下问题:Python Adafruit_Thermal.printBitmap方法的具体用法?Python Adafruit_Thermal.printBitmap怎么用?Python Adafruit_Thermal.printBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_Thermal
的用法示例。
在下文中一共展示了Adafruit_Thermal.printBitmap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: import Adafruit_Thermal [as 别名]
# 或者: from Adafruit_Thermal import printBitmap [as 别名]
printer.justify('C')
printer.println("normal\nline\nspacing")
printer.setLineHeight(50)
printer.println("Taller\nline\nspacing")
printer.setLineHeight() # Reset to default
printer.justify('L')
# Barcode examples
printer.feed(1)
# CODE39 is the most common alphanumeric barcode
printer.printBarcode("ADAFRUT", printer.CODE39)
printer.setBarcodeHeight(100)
# Print UPC line on product barcodes
printer.printBarcode("123456789123", printer.UPC_A)
# Print the 75x75 pixel logo in adalogo.py
import gfx.adalogo as adalogo
printer.printBitmap(adalogo.width, adalogo.height, adalogo.data)
# Print the 135x135 pixel QR code in adaqrcode.py
import gfx.adaqrcode as adaqrcode
printer.printBitmap(adaqrcode.width, adaqrcode.height, adaqrcode.data)
printer.println("Adafruit!")
printer.feed(3)
# Reset printer
printer.setDefault()
printer.flush()
printer.sleep()
示例2: Adafruit_Thermal
# 需要导入模块: import Adafruit_Thermal [as 别名]
# 或者: from Adafruit_Thermal import printBitmap [as 别名]
#!/usr/bin/python
from Adafruit_Thermal import *
printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)
# Print the 75x75 pixel logo in adalogo.py
import gfx.wayfinding as wayfinding
printer.printBitmap(wayfinding.width, wayfinding.height, wayfinding.data)
printer.sleep() # Tell printer to sleep
printer.wake() # Call wake() before printing again, even if reset
printer.setDefault() # Restore printer to defaults
示例3: Adafruit_Thermal
# 需要导入模块: import Adafruit_Thermal [as 别名]
# 或者: from Adafruit_Thermal import printBitmap [as 别名]
#!/usr/bin/python
import subprocess, sys
from Adafruit_Thermal import *
size = 54
base_line = 90
spacing = 16
printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)
#printer.setTimes(120000, 8400)
p = subprocess.Popen(["./FontPrinter", "-c", sys.argv[1], "-s", "%d" % (size), "-b", "%d" % (base_line), "-d", "%d" % (spacing), sys.argv[2]], stdout=subprocess.PIPE)
out, err = p.communicate()
data = out.split(",")
width = int(data.pop(0))
height = int(data.pop(0))
data = map(ord,data[0].decode("hex"))
print "font: ", sys.argv[2], " c: ", sys.argv[1], " width: ", width, " height: ", height
printer.printBitmap(width, height, data)
示例4: Adafruit_Thermal
# 需要导入模块: import Adafruit_Thermal [as 别名]
# 或者: from Adafruit_Thermal import printBitmap [as 别名]
#!/usr/bin/python
from Adafruit_Thermal import *
printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)
# Test inverse on & off
printer.inverseOn()
printer.println("Inverse ON")
printer.inverseOff()
# Test character double-height on & off
printer.doubleHeightOn()
printer.boldOn()
printer.justify('L')
printer.println("STUDIO-X NEW YORK")
# Print the 75x75 pixel logo in adalogo.py
import img as img
printer.printBitmap(img.width, img.height, img.data)
printer.sleep() # Tell printer to sleep
printer.wake() # Call wake() before printing again, even if reset
printer.setDefault() # Restore printer to defaults