Python Forum
[Tkinter] update the content of Text widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] update the content of Text widget
#1
hi
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
Reply


Messages In This Thread
update the content of Text widget - by atlass218 - Nov-19-2018, 09:05 PM
RE: update the content of Text widget - by woooee - Nov-19-2018, 09:31 PM
RE: update the content of Text widget - by jfong - Nov-27-2018, 02:34 AM
RE: update the content of Text widget - by jfong - Nov-27-2018, 07:57 AM
RE: update the content of Text widget - by jfong - Nov-28-2018, 03:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 5,285 Jun-26-2022, 06:26 PM
Last Post: menator01
  How to instantly update the plot by getting values from a Scale widget? OLE 20 6,697 May-18-2022, 02:35 AM
Last Post: OLE
  [Tkinter] Make my button text update? Skata100 1 2,103 Aug-07-2021, 05:37 AM
Last Post: deanhystad
  [Tkinter] Text widget inert mode on and off rfresh737 5 4,038 Apr-19-2021, 02:18 PM
Last Post: joe_momma
  update text variable on label with keypress knoxvilles_joker 3 5,083 Apr-17-2021, 11:21 PM
Last Post: knoxvilles_joker
  Line numbers in Text widget rfresh737 3 5,617 Apr-15-2021, 12:30 PM
Last Post: rfresh737
  tkinter text widget word wrap position chrisdb 6 7,746 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  [Tkinter] Get the last entry in my text widget Pedroski55 3 6,562 Jul-13-2020, 10:34 PM
Last Post: Pedroski55
  How to place global tk text widget in class or on canvas puje 1 2,402 Jul-04-2020, 09:25 AM
Last Post: deanhystad
  [Tkinter] how to update label text from list Roshan 8 5,617 Apr-25-2020, 08:04 AM
Last Post: Roshan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020