У меня получилось)
import clr, sys, System
clr.AddReference("System.Windows.Forms")
clr.AddReference('System.Drawing')
import System.Drawing
import System.Windows.Forms
from System.Drawing import *
from System.Windows.Forms import *
text1 = IN[0]
text2 = IN[1]
lspace = IN[2]
font = IN[3]
size = IN[4]
var = int(IN[5])
fonts,sizes1,fonts2,sizes2 = [],[],[],[]
for i,l in zip(text1,text2):
font1 = System.Drawing.Font(font, size)
wd1 = TextRenderer.MeasureText(i,font1).Width
wd2 = TextRenderer.MeasureText(l,font1).Width
space1 = TextRenderer.MeasureText(lspace,font1).Width
fonts.append(font1)
sizes1.append(wd1)
sizes2.append(wd2)
max1 = 0
max2 = 0
amax = 0
ki1,ki2 = [],[]
for ii in sizes1:
if ii > max1:
max1 = ii
ki1.append(max1)
for ii1 in text1:
if len(ii1) > amax:
amax = len(ii1)
ki2.append(amax)
for ki in sizes2:
if ki > max2:
max2 = ki
x1,x2,x3,x4,x5 = [],[],[],[],[]
for i,m in zip(text1,sizes1):
if (max1-m-9) > 0:
n = len(i)
kr1 = (max1-m+var)/(space1-9)+n
c = i.ljust(kr1," ")
x1.append(c)
else:
c = i.ljust(0," ")
x1.append(c)
for k in text2:
d = k.ljust(max2/space1," ")
x2.append(d)
xx1,xx2 = [],[]
for num, (mat,thick) in enumerate(zip(x1,x2)):
xx1.append ("".join([str(num+1)+". "+mat + " "+thick]))
param1 = "\n".join(xx1)
OUT = param1