I'd like to allow the user to copy and paste a folder address using into a pysimplegui UI and then use that text to get a list of the files in the folder.
import PySimpleGUI as psg
import pathlib as pl
#set the theme for the screen/window
psg.theme("LightPurple")
#define layout
layout=[[psg.Text("Folder Address",size=(15, 1), font='Lucida',justification='right'),psg.Input()],
[psg.Button("SAVE", font=("Times New Roman",12)),psg.Button("CANCEL", font=("Times New Roman",12))]]
#Define Window
win =psg.Window("Data Entry",layout)
#Read values entered by user and pass that input to a windows path
v=win.read()
d = pl.WindowsPath(v)# I'm pretty sure this is where I'm going wrong.
#close first window
win.close()
#define layout for second windows to display data entered by user in first window
layout1=[[psg.Text("The data you entered is :", size=(20,1), font='Lucida', text_color='Magenta')],
[psg.Text(str([e for e in dir_path.iterdir()]), font='Lucida', text_color='Blue')]]
#Define Window and display the layout to print output
win1=psg.Window("Output Screen",layout1)
e,v=win1.read()
#close second window
win1.close()
I'm happy to play around with the formatting etc, but if anyone had any insight (or a good tutorial on pysimplegui) it would be much appreciated.