fixed spacing issues with e-mini items in prof display
This commit is contained in:
parent
e4a17ec354
commit
bfb4feae18
@ -946,27 +946,47 @@ class StockTicker():
|
||||
|
||||
img = img.crop((0,0,max(w1, w2) + 20,32))
|
||||
return img
|
||||
|
||||
|
||||
|
||||
def textToImageProf(self, TICKER, CURRENT, CHANGE, ARROW, font):
|
||||
|
||||
text_width_current, text_height = self.get_text_dimensions(CURRENT, font)
|
||||
|
||||
img = Image.new('RGB', (text_width_current +100 , 32))
|
||||
d = ImageDraw.Draw(img)
|
||||
if 'E-MINI' in TICKER:
|
||||
w1, text_height = self.get_text_dimensions(TICKER, font)
|
||||
w2, text_height = self.get_text_dimensions(CURRENT, font)
|
||||
text_width_current = max(w1,w2)
|
||||
|
||||
d.text((4, 0), TICKER, fill=(255, 255, 255), font=font)
|
||||
d.text((4, 8), CURRENT, fill=self.greenORred, font=font)
|
||||
img = Image.new('RGB', (text_width_current +100 , 32))
|
||||
d = ImageDraw.Draw(img)
|
||||
|
||||
img.paste(ARROW, ((text_width_current + 7),10))
|
||||
d.text(((text_width_current+18), 8), CHANGE, fill=self.greenORred, font=font)
|
||||
d.text((4, 0), TICKER, fill=(255, 255, 255), font=font)
|
||||
d.text((4, 8), CURRENT, fill=self.greenORred, font=font)
|
||||
|
||||
text_width_change, text_height = self.get_text_dimensions(CHANGE, font)
|
||||
img.paste(ARROW, ((w2 + 7),10))
|
||||
d.text(((w2+18), 8), CHANGE, fill=self.greenORred, font=font)
|
||||
|
||||
newWidth = text_width_current + text_width_change +30
|
||||
text_width_change, text_height = self.get_text_dimensions(CHANGE, font)
|
||||
newWidth = max(w2 + text_width_change, text_width_current) +15
|
||||
img = img.crop((0,0,newWidth,32))
|
||||
|
||||
img = img.crop((0,0,newWidth,32))
|
||||
else:
|
||||
text_width_current, text_height = self.get_text_dimensions(CURRENT, font)
|
||||
|
||||
img = Image.new('RGB', (text_width_current +100 , 32))
|
||||
d = ImageDraw.Draw(img)
|
||||
|
||||
d.text((4, 0), TICKER, fill=(255, 255, 255), font=font)
|
||||
d.text((4, 8), CURRENT, fill=self.greenORred, font=font)
|
||||
|
||||
img.paste(ARROW, ((text_width_current + 7),10))
|
||||
d.text(((text_width_current+18), 8), CHANGE, fill=self.greenORred, font=font)
|
||||
|
||||
text_width_change, text_height = self.get_text_dimensions(CHANGE, font)
|
||||
newWidth = text_width_current + text_width_change +30
|
||||
img = img.crop((0,0,newWidth,32))
|
||||
|
||||
return img
|
||||
|
||||
|
||||
#Stitch the logo & prices picture into one image
|
||||
def stitchImage(self, image_list):
|
||||
widths, heights = zip(*(i.size for i in image_list))
|
||||
|
Loading…
Reference in New Issue
Block a user