Python Forum
[Tkinter] How to insert data json to treeview tkinter?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to insert data json to treeview tkinter?
#7
does not work with load, it says

Error:
AttributeError: 'str' object has no attribute 'read'
with loads it shows me the json data in the treeview.

Now I have another question, I have some entries to be able to modify the data obtained from the treeview. These work and when I modify them in the tree they are updated, but how would I call the json in this situation to update the values and not to add them as another object in the list?

with this I select the object in the tree

    def select_record():
        logo_lb.delete(0,END) 
        nombre_lb.delete(0,END)
        tenantid_lb.delete(0,END)
        aplicationid_lb.delete(0,END)
        secretid_lb.delete(0,END)
        token_lb.delete(0,END)
        periodicidad_lb.delete(0,END)
        region_combobox2.delete(0,END)

        selected = json_tree.focus() e
        values = json_tree.item(selected,'values') 
        
        logo_lb.insert(0, values[0]) 
        nombre_lb.insert(0,values[1])
        tenantid_lb.insert(0,values[2])
        aplicationid_lb.insert(0,values[3])
        secretid_lb.insert(0,values[4])
        token_lb.insert(0,values[5])
        periodicidad_lb.insert(0,values[6])
        region_combobox2.insert(0,values[7])
with this I save the updates, which are only visualized in the tree but as it is not connected with the json, the changes are not made in the file.

 def update_record():
     selected = json_tree.focus()      
     json_tree.item(selected, text='', values=(logo_lb.get(),nombre_lb.get(),tenantid_lb.get(),aplicationid_lb.get(),secretid_lb.get(),token_lb.get(),periodicidad_lb.get(),region_combobox2.get())) 

        logo_lb.delete(0,END) 
        nombre_lb.delete(0,END)
        tenantid_lb.delete(0,END)
        aplicationid_lb.delete(0,END)
        secretid_lb.delete(0,END)
        token_lb.delete(0,END)
        periodicidad_lb.delete(0,END)
        region_combobox2.delete(0,END)
[Image: Captura-de-pantalla-2023-01-18-160741.png]
Reply


Messages In This Thread
RE: How to insert data json to treeview tkinter? - by Shakanrose - Jan-18-2023, 07:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter - update/refresh treeview snakes 5 21,285 Dec-02-2023, 07:05 PM
Last Post: aynous19
  [Tkinter] Search data in treeview without search button TomasSanchexx 3 1,700 Aug-12-2023, 03:17 AM
Last Post: deanhystad
  TKinter JSON Key Error Nu2Python 4 1,425 Jan-02-2023, 10:15 PM
Last Post: Nu2Python
  [Tkinter] Different rows colours in treeview tkinter Krissstian 1 1,348 Nov-20-2022, 09:59 PM
Last Post: woooee
  [Tkinter] About Tkinter Treeview.selection_get() usage. water 3 8,520 Feb-12-2022, 02:19 PM
Last Post: water
  [Tkinter] [split] Is there a way to embed a treeview as a row inside another treeview? CyKlop 5 3,461 Oct-20-2021, 12:14 AM
Last Post: CyKlop
  [Tkinter] How to insert 'Checkbutton' to 'Treeview' and associate each item? water 2 13,378 Dec-19-2020, 05:24 PM
Last Post: water
  [Tkinter] acceleration of data output in treeview tkinter Vladimir1984 4 4,277 Nov-21-2020, 03:43 PM
Last Post: Vladimir1984
  tkinter| listbox.insert problem Maryan 3 3,593 Sep-29-2020, 05:34 PM
Last Post: Yoriz
  how to insert image into Text widget Tkinter atlass218 5 10,117 Apr-17-2019, 05:28 AM
Last Post: atlass218

Forum Jump:

User Panel Messages

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