How can I associate a button to a tutorial file?
It depend on how you show the representation for a tutorial file on a button, an item in Listbox, an node in Tree, a row in Table or a Text. Maybe only filename, or tutorial name shown. You have to define the relationship between the representation and the filename, maybe in a dictionary, then you can find the filename from the representation directly.
For example:
import PySimpleGUI as sg
font = ('Courier New', 11)
sg.set_options(font=font)
sg.theme('DarkBlue3')
path = "D:\\Users\\raulc\\Documents\\AMBIENTES\\videos\\111"
files = [
'01 Whetting Your Appetite.pptx',
'02 Using the Python Interpreter.pptx',
'03 An Informal Introduction to Python.pptx',
'04 More Control Flow Tools.pptx',
'05 Data Structures.pptx',
'06 Modules.pptx',
'07 Input and Output.pptx',
'08 Errors and Exceptions.pptx',
'09 Classes.pptx',
'10 Brief Tour of the Standard Library.pptx',
'11 Virtual Environments and Packages.pptx',
'12 What Now.pptx',
'13 Interactive Input Editing and History Substitution.pptx',
'14 Representation Error.pptx',
]
tutorials = {filename.split('.')[0]:filename for filename in files}
column_layout = [[sg.Text(text, enable_events=True, expand_x=True, text_color='white', background_color='green', key=text)] for text in tutorials]
layout = [
[sg.Text('Python Tutorials:')],
[sg.Column(column_layout, scrollable=True, vertical_scroll_only=True)],
]
window = sg.Window('Tutorial', layout, finalize=True)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Exit':
break
elif event in tutorials:
fullpath = path + '\\' + tutorials[event]
print(fullpath)
window.close()

How can I make a function that checks if the array increased it size? Because I read p111 as a list with p111 = os.listdir("D:\Users\raulc\Documents\AMBIENTES\videos\111") .
As above, dictionary created from the file list, so you can compare if old and new dictionaries same or with same size.