This code works as intended when run alone:
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
myFrame = tk.Frame(root)
def actionTest():
filename = filedialog.askopenfilename()
svTitle.set(filename)
lblTitle.update()
svTitle = tk.StringVar()
lblTitle = tk.Label(myFrame, textvariable=svTitle)
lblTitle.pack()
btnTest = tk.Button(myFrame, text="Test", command=actionTest)
btnTest.pack()
lblTitle.pack()
btnTest.pack()
myFrame.pack()
root.mainloop()
However, when the code is run within a bigger block of code, the label doesn’t display or update text. Please help!