I'm trying to make "My own Photo Editor" but I face a problem while I try to get the get working dir that I stored in a function variable. I tried many other ways but I still don't get "my current directory info" on updated base.
Try to make a new Image Editor on python with the help of tkinter GUI.
photo= ''
def open_image(event=None):
global photo
directory= ''
url= filedialog.askopenfilename(initialdir=os.getcwd(), title='Select File',
filetypes=(('Text File', '*.jpg'),('All files', '*.*')))
img= Image.open(url)
Max_size= (1030,686)
img.thumbnail(Max_size)
photo= ImageTk.PhotoImage(img)
img_label= tk.Label(frame,image=photo, bg='red')
img_label.focus()
img_label.grid(row=0, column=0, sticky='s', padx=13, pady=17)
directory= url
label= tk.Label(main_application, text=directory, borderwidth=5, relief='sunken', padx=0, pady=5, font=('arial',7,'bold'))
label.pack(side=tk.BOTTOM, anchor='w', pady=5, fill='both')
return directory
save_dir= open_image()
I want directory variable value which have my 'url of a image'. When I call it outside from a function like (save_dir= open_image()) it save url/directory path but after it gives me the same path again and again. Even if I change the directory it show the same directory which I opened first time. I want updated directory info.