Tkinter Python - Json + Entry

Asked

Viewed 16 times

0

I am trying to create a window with 3 Entry, and 2 buttons, one to open a JSON and load some data into these entrys and the other button to save the changes in JSON.

Save button and Entry positions are already ok!

The problem is to open and load the JSON data as it is a array a little long. Below my function.

def abrirArquivo(self):
data = {
    "first_name": self.txtemail.get()
}
with open('name.json', 'w') as f:
    json.dump(data, f, indent=4)

filename =  filedialog.askopenfile(title = "Select file",filetypes = (("Json Files","*.json"),("all files","*.*")))

self.txtemail.insert(0, filename)
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.