Nov-19-2018, 09:05 PM
hi
I try to update the content of Text widget by using this fonction:
can you help me please
I try to update the content of Text widget by using this fonction:
def affichage_ddm_axe_loc35R_update (): with open('archives/ILS_35R/loc35R/releves_mesure_loc35R/ddm_axe_loc35R/ddm_axe_monitor1_loc35R.txt') as ddm_axe_monitor1, open('archives/ILS_35R/loc35R/releves_mesure_loc35R/ddm_axe_loc35R/ddm_axe_monitor2_loc35R.txt') as ddm_axe_monitor2: s_generalites_bottom_axe_loc35R= Scrollbar(generalites_bottom) T_generalites_bottom_axe_loc35R= Text(generalites_bottom,bg='powder blue',width=450,height=350,font=('arial',14,'bold')) s_generalites_bottom_axe_loc35R.pack(side=RIGHT, fill=Y) T_generalites_bottom_axe_loc35R.pack(side=LEFT, fill=Y) s_generalites_bottom_axe_loc35R.config(command=T_generalites_bottom_axe_loc35R.yview) T_generalites_bottom_axe_loc35R.config(yscrollcommand=s_generalites_bottom_axe_loc35R.set) while True: line1 = ddm_axe_monitor1.readline() if len(line1) == 0: break line1 = line1.strip().split() line2 = ddm_axe_monitor2.readline() line2 = line2.strip().split() T_generalites_bottom_axe_loc35R.insert(END, f'{line1[0]:15}\t {line1[1]:10}\t\t {line2[1]:10}\n') T_generalites_bottom_axe_loc35R.after(1000, update)the above python code is inspired from the following code :
def update(): with open("htfl.txt","r") as f: data = f.read() T.insert(END,data) T.after(1000, update)the update of the content of the Text was actually done but only once time and not in a continuous and multiple times
can you help me please