PySimpleGUI: How to select an image from file browser and save to another folder

  pysimplegui, python

Is there a simple way to select an image from the filebrowser, view it and then move it to another folder using PySimpleGUI. I have the code for selecting an image but I don’t know how to view it and move to another folder.

import PySimpleGUI as sg
import os
from PIL import Image, ImageTk
import io
import sys

# Get the file for test image
if len(sys.argv)==1:
    fname = sg.popup_get_file('Select Image To Use as TestImage', default_path='')
else:
    fname = sys.argv[1]
    
if not fname:
    sg.popup_cancel('Cancelling')
    raise SystemExit()
else:
    sg.popup('The file chosen is', fname)

This is the code for selecting an image.

How can I view in my UI and move the selected image to another folder. Sort of like uploading an image and storing it on a server(like in social media platforms)

Source: Python Questions

LEAVE A COMMENT