I want to divide "functions" and "GUI" to different header files to make the code more convenient to read. However, I can't use the functions that I've implemented in my second header file after importing it to my first one. This is a function:
def openNewWindow():
newWindow = Toplevel()
newWindow.title("Help")
newWindow.geometry("200x200")
Label(newWindow,
text ="This is a guider").pack(main)
And this is the GUI:
Help = Button(settingFrame, image=test, text="help", width=388, height=50,
compound="c", fg="red", command = lambda :[openNewWindow]))
Help.place(x=10, y=55)
When I try to click on the "Help" button it says that "NameError: name 'openNewWindow' is not defined". How to solve that problem?
CodePudding user response:
To solve that problem, I needed to run the function file first and then the GUI file. That way, the function file "updates" and then the GUI file accepts the updated data.