我使用一个表但是,我在画布中绘制来控制flowables的位置,这是因为我在pdf中有一个模板,我与pyPDF合并.
换行是在一张桌子上完成的,但是文字上升了,而不是我希望的那样.
c是画布
码
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph, Table
from reportlab.lib.units cm
width, height = A4
styles = getSampleStyleSheet()
def coord(x, y, unit=1):
x, y = x * unit, height - y * unit
return x, y
descrpcion = Paragraph('long paragraph', styles["Normal"])
partida = Paragraph('1', styles["Center"])
candidad = Paragraph('120', styles["Center"])
precio_unitario = Paragraph('$52.00', styles["right"])
precio_total = Paragraph('$6240.00', styles["right"])
data= [[partida, candidad, descrpcion, precio_unitario, precio_total]]
table = Table(data, colWidths=[2.05 …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ttk模块为tkinter中的GUI应用程序创建Windows的可执行文件.我用cx_freeze创建了一个exe,但是当我在控制台中运行应用程序时,它给出了以下错误:
D:\My Dropbox\python\SAR Calculator\src\dist_tk>
Traceback (most recent call last):
File "C:\Python31\lib\site-packages\cx_Freeze\
7, in <module>
exec(code, m.__dict__)
File "sarcalc_tk.py", line 14, in <module>
File "C:\Python31\lib\tkinter\__init__.py", li
from tkinter import _fix
ImportError: cannot import name _fix
Run Code Online (Sandbox Code Playgroud)
以下是我的代码中的第14行和第15行:
import tkinter as tk
import tkinter.ttk as ttk
Run Code Online (Sandbox Code Playgroud) 我可以使用tkFont进行文本测量,但我不想要根窗口 - > tk.Tk()
我希望找到空标签,这是一个例子
txt ="<lol1><><lol2>"
rgx = "<([a-zA-Z_0-9]+)>"
print re.findall(rgex, txt)
Run Code Online (Sandbox Code Playgroud)
我明白了
['lol1', 'lol2']
Run Code Online (Sandbox Code Playgroud)
我想要
['lol1', '', 'lol2']
Run Code Online (Sandbox Code Playgroud)
我怎么用正则表达式做到这一点?