当前位置: 首页>>代码示例>>Python>>正文


Python Adafruit_Thermal.printBitmap方法代码示例

本文整理汇总了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()
开发者ID:nearengine,项目名称:Python-Thermal-Printer,代码行数:31,代码来源:printertest.py

示例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
开发者ID:miketeix,项目名称:Python-Thermal-Printer,代码行数:18,代码来源:printertest.py

示例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)

开发者ID:knied,项目名称:FontPrinter,代码行数:21,代码来源:print_glyph.py

示例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
开发者ID:ebberly,项目名称:printerTemp,代码行数:29,代码来源:xoupprintertest.py


注:本文中的Adafruit_Thermal.printBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。