0

I am having trouble displaying/ recreating the .txt file like it is in the list box. In the .txt file the lines and evrething is in order like i want it, but I don't have the same thing in the program. I take the inputs from lists and put them in the file and a similar command to print them in the list box. This is how is in the .txt file and how i want it.

AAAA            dkhfaksfh       bsgfdkjashfks   jsfgdjgfad                     sfgujdfjasdg   
Adonis          Nikolaou        992345232       adonisnik@gmail.com            23789456       
Andreas         Nikolaou        96124578        andreasnik@gmail.com           22584769       
Andreas         Panagi          99634563        andreas1@hotmail.com           23584714       
Andreas         Paxih           99790535        andreas@gmail.com              22633718          

In the list box is something like this, only the first column is in place.

AAAA           dkhfaksfh      bsgfdkjashfks  jsfgdjgfad                     sfgujdfjasdg  
Adoni     Nikolaou      992345232       adonisnik@gmail.com         23789456   
Andreas   Nikolaou    96124578      andreasnik@gmail.com        22584769       
Andreas    Panagi      99634563       andreas1@hotmail.com           23584714       
Andreas             Paxih             99790535        andreas@gmail.com              22633718       

This is how I write it in the txt file.

for i in range(len(Name)):
        g.write('%-15s %-15s %-15s %-30s %-15s\n' %(Name[i], Last[i], Phone[i], Email[i],Home[i]))

This is how I "print" the text in the list box.

for i in range(len(Name)):
        line = '%-15s %-15s %-15s %-30s %-15s' %(Name[i], Last[i], Phone[i], Email[i],Home[i])
        List_Box.insert(tk.END,line)

0 Answers0