Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在reportlab中以数字方式定位条形码?_Python_Reportlab - Fatal编程技术网

Python 如何在reportlab中以数字方式定位条形码?

Python 如何在reportlab中以数字方式定位条形码?,python,reportlab,Python,Reportlab,我有一个具体的案例,我似乎想不出解决的办法。我正在为Python编写ReportLab中的shipping label模板对象。我有以下代码创建一个条形码作为图形 uspsBarcode = createBarcodeDrawing('USPS_4State', value=self.imbval, routing=self.zip4.replace('-','')) print uspsBarcode.getBounds() # print out of position and scale

我有一个具体的案例,我似乎想不出解决的办法。我正在为Python编写ReportLab中的shipping label模板对象。我有以下代码创建一个条形码作为图形

uspsBarcode = createBarcodeDrawing('USPS_4State', value=self.imbval, routing=self.zip4.replace('-',''))
print uspsBarcode.getBounds() # print out of position and scale

使用该代码,我随后将其添加到一个形状组中,并返回该形状组。因此,我需要条形码相对于对象进行定位。我似乎找不到任何方法将定位传递给这个,即使我已经挖掘了遗产。尽管您可以从打印中看到,定位设置在某个位置。

仅适用于遇到此问题的任何其他人。事实证明,如果将条形码图形放在形状组中,则可以使用shift函数以数字方式移动形状组容器

uspsBarcode = shapes.Group()
bc = createBarcodeDrawing('USPS_4State', value=self.imbVal, routing=self.zip4.replace('-',''))
uspsBarcode.add(bc)
uspsBarcode.shift(self.x+(s*0.2), self.y)