Can someone help me with my python code my datasheet.txt doesn’t…

Question Answered step-by-step Can someone help me with my python code my datasheet.txt doesn’t… Can someone help me with my python code my datasheet.txt doesn’t show the data that I’ve input also can you explain me the necessary codes used for recording the data inside a file. here is my source codefrom tkinter import*from tkinter import messageboximport ast#windowwindow=Tk()window.title(‘Signup’)window.geometry(‘925×500+300+200’)window.configure(bg=”red”)window.resizable(False,False)#signup error handling and data inputdef signup():    username=user.get()    password=code.get()    confirm_password=confirm_code.get()    if password == confirm_password:        try:            file=open(‘datasheet.txt’, ‘r+’)            d=file.read()            r=ast.literal_eval(d)            dict2.ast={username:password}            r.update(dict2)            file.truncate(0)            file.close()            file=open(‘datasheet.txt’, ‘w’)            w=file.write(str(r))            messagebox.showinfo(‘Signup’, ‘Successfully signed up’)        except:            file=open(‘datasheet.txt’,’w’)            pp=str({‘Username’:’password’})            file.write(pp)            file.close()    else:        messagebox.showerror(‘Invalid’, “Both Password should match”)#imageimg = PhotoImage(file=’llanera.png’)Label(window,image=img,bg=’white’).place(x=-10,y=-50)#frameframe=Frame(window,width=350,height=390,bg=’white’)frame.place(x=520,y=50)heading=Label(frame,text=’Sign up’, fg=’#57a1f8′,bg=’white’,font=(‘Microsoft YaHei UI Light’,23,’bold’))heading.place(x=117,y=5)#usernamedef on_enter(e):    user.delete(0,’end’)def on_leave(e):    name=user.get()    if name == ”:        user.insert(0,’Username’)user = Entry(frame,width=25,fg=’black’,border=0,bg=’white’,font=(‘Microsoft YaHei UI Light’,11,’bold’))user.place(x=30,y=80)user.insert(0,’Username’)user.bind(‘‘, on_enter)user.bind(‘‘, on_leave)Frame(frame, width=295,height=2,bg=’black’).place(x=25,y=107)#passworddef on_enter(e):    code.delete(0,’end’)def on_leave(e):    name=code.get()    if name == ”:        code.insert(0,’Password’)code = Entry(frame,width=25,fg=’black’,border=0,bg=’white’,font=(‘Microsoft YaHei UI Light’,11,’bold’))code.place(x=30,y=150)code.insert(0,’Password’)code.bind(‘‘, on_enter)code.bind(‘‘, on_leave)Frame(frame, width=295,height=2,bg=’black’).place(x=25,y=177)#confirmpassworddef on_enter(e):    confirm_code.delete(0,’end’)def on_leave(e):    name=confirm_code.get()    if name == ”:        confirm_code.insert(0,’Password’)confirm_code = Entry(frame,width=25,fg=’black’,border=0,bg=’white’,font=(‘Microsoft YaHei UI Light’,11,’bold’))confirm_code.place(x=30,y=220)confirm_code.insert(0,’Confirm Password’)confirm_code.bind(‘‘, on_enter)confirm_code.bind(‘‘, on_leave)Frame(frame, width=295,height=2,bg=’black’).place(x=25,y=247)#signup buttonButton(frame,width=39,pady=7,text=’Sign up’,bg=’#57a1f8′,fg=’white’,border=0,command=signup).place(x=35,y=280)label=Label(frame,text=’I have an account’,fg=’black’,bg=’white’,font=(‘Microsoft YaHei UI Light’,9))label.place(x=90,y=335)signin=Button(frame,width=6,text=’Sign in’,border=0,bg=’white’, cursor=’hand2′,fg=’#57a1f8′)signin.place(x=200,y=336)window.mainloop() Computer Science Engineering & Technology Python Programming CONSTRUCTI 123 Share QuestionEmailCopy link Comments (0)