I have two functions and two GUI. I cannot get them to work after each other. first, I want to open my browse GUI then editing GUI. help me out, please.
from tkinter import *
from tkinter import filedialog
window = Tk()
def fileme():
root = Tk()
root.withdraw()
file_path = filedialog.askopenfilenames(filetypes=[("Text file","*.txt")])
print(file_path)
window.withdraw()
with open(file_path[0]) as f:
f_contents = f.read()
b=(f_contents)
print(b)
window.title('Edit and save text files by Ali')
frame = Frame(window)
btn = Button(frame, text = 'Browse', command= fileme)
btn.pack(side = RIGHT , padx =55)
frame.pack(padx=100,pady = 30)
root=Tk()
x=filedialog.askopenfilename(filetypes=[("Text file","*.txt")])
T=Text(root,state='normal', height=20, width=70)
T.pack()
T.insert(END, open(x).read())
def save():
b = T.get('1.0', END)
f = open(x, 'wt')
f.write(b)
f.close()
btn= Button(root, text='Save', command=save)
btn.pack(side = RIGHT , padx =55)
window.mainloop()
root.mainloop()