I have a class where I create a Label on the init method:
import tkinter as tk
from tkinter.filedialog import askopenfilename
class app(tk.Tk):
    def __init__(self, master):
        label1 = tk.Label(master, text="Select file...")
        label1.pack()
Then with a button I call a method to choose a file and change the label text to filename path.
    def files(self):
        filename = askopenfilename()
        self.label1.config(text=filename)
The problem is that when I choose the file, the app gets closed without errors, so I don't know what's going on.
Outside the class I have:
root = tk.Tk()
app_gui = app(root)
root.mainloop()