Apr-19-2022, 12:33 AM
issue: columns become slightly miss-aligned- not a whole character(1/4-1/2 maybe) but enough to tell and look bad.
situation: taking returned data from a sort and using below to take each row and format it and add to a string to add to a text input box.
I am weak on string formatting but when i step through record by record and field by field and record the math between each column spacing, it equates correctly- taking into account the text length and spacing.
Question: Could a empty field somehow impart a few pixels off? I wanted to attach a screen shot of the misalignment but could not figure out how to do that-sorry.
A couple of rows of returned data (animals)look similar to below with some fields typicially having no data:
-('4','Yellow','','Bull Lot',11,'','')
-('23','Yellow','2018','Hermas',20,'','')
situation: taking returned data from a sort and using below to take each row and format it and add to a string to add to a text input box.
I am weak on string formatting but when i step through record by record and field by field and record the math between each column spacing, it equates correctly- taking into account the text length and spacing.
Question: Could a empty field somehow impart a few pixels off? I wanted to attach a screen shot of the misalignment but could not figure out how to do that-sorry.
A couple of rows of returned data (animals)look similar to below with some fields typicially having no data:
-('4','Yellow','','Bull Lot',11,'','')
-('23','Yellow','2018','Hermas',20,'','')
def build_cow_sc(self,animals): self.cow_abbr_txt.text='' for cow in animals: t='' item=0 while item < len(cow): t=t+str(str(cow[item]).ljust(40-len(str(cow[item]))))#+" " item+=1 self.cow_abbr_txt.text=self.cow_abbr_txt.text +'\n'+ t