2015-05-08 17 views
0

我有一個特定的情況,我似乎無法找出解決方案。我正在爲ReportLab for Python編寫一個運輸標籤模板對象。我有以下代碼作爲圖形創建條形碼。如何在數據中定位reportlab中的條形碼?

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

使用該代碼,我稍後將其添加到一個形狀組,並且該形狀組被返回。所以我需要條形碼相對於物體的位置。我似乎無法找到任何方式將定位傳遞給此,即使我已經挖掘了繼承。雖然從印刷中可以看出,定位設置爲somwhere

回答

0

只適用於其他人,而且會遇到此問題。事實證明,如果將條形碼圖形放入形狀組中,則形狀組容器可以通過移位功能在數字上移動。

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) 
相關問題