通过Python使用输入变量打印条形码TSC标签

时间:2019-12-05 09:44:23

标签: python variables barcode

嗨stackoverflowmembers,

不幸的是,经过很多尝试,我有点绝望。 我将非常感谢您的帮助。 可能是因为我是Python的绝对初学者。

我想用一个小程序在我的TSC-TDP 225条码打印机上打印条码。 我想打印一个输入变量,但我没有成功。可以随时输入命令吗?还是我必须在那里转换一些东西?

用我的尝试之一封闭了我的代码:

# -*- coding: utf-8 -*- 
"""
Spyder Editor
"""

import ctypes
#import subprocess

mydll = ctypes.windll.LoadLibrary('C:\DEVELOP\BARCODE\TSCLIB.dll')
print ("Start Printing")
mydll.openportW("TSC_TDP-225")
mydll.setup("32","25","5","10","0","0","0")
mydll.clearbuffer()

"""
#Input variable
#bc = input("BARCODE: ")                   
#print(bc)
"""

# LABEL TEMPLATE
mydll.sendcommandW("SIZE 41.5 mm,25.0 mm")
mydll.sendcommandW('GAP 3 mm,0 mm')
mydll.sendcommandW('DIRECTION 0')
mydll.sendcommandW('CLS')

# DRAW LABEL IMAGE
"""
#Some try...
#mydll.barcodeW("260","159","25","102","1","180","2","6", "$_GET['bc']");
#mydll.barcodeW("260","159","25","102","1","180","2","6", @(bc));
#subprocess.call(["mydll.barcodeW("260","159","25","102","1","180","2","6","'+bc+'"']);
"""

#Barcode works in line
mydll.barcodeW("260","159","25","102","1","180","2","6","1234567810");

# PRINT
mydll.sendcommandW('PRINT 1,1')
mydll.closeport()
print ("Finished Printing")

你能帮我吗?

0 个答案:

没有答案