import os # make sure in code directory os.chdir(os.path.dirname(__file__)) with open('loc1.txt') as loc1, open('loc2.txt') as loc2: head = ['Date', 'Value 1', 'Value2'] print(f'{head[0]:15} {head[1]:10} {head[2]:10}') while True: line1 = loc1.readline() if len(line1) == 0: break line1 = line1.strip().split() line2 = loc2.readline() line2 = line2.strip().split() print(f'{line1[0]:15} {line1[1]:10} {line2[1]:10}')results:
Output:Date Value 1 Value2
21/06/18 -0.7 -0.7
22/06/18 -0.5 -0.5
06/07/18 -0.7 -0.8
13/07/18 -0.6 -0.7
20/07/18 -0.3 -0.3
27/07/18 -0.5 -0.7
10/08/18 -1.2 -1.0
17/08/18 -0.5 -0.5
24/08/18 -0.3 -0.3
21/09/18 -0.2 -0.2
28/09/18 -0.4 -0.5
17/10/18 -0.1 -0.3
you can add the gui code to insert into your widgetThis code uses f-string (python 3.6 and newer)