To add Python syntax errors and functions

Asked 2 years ago, Updated 2 years ago, 17 views

btncmd = def read_all_file(path): 
btn1 = Button(root, width=20, height=100, command=btncmd)
btn1.pack()

There is a syntax error in the btncmd part, how can I solve it?

python

2022-09-20 17:46

1 Answers

def is the command used to specify a function. It should be used as follows:

def read_all_file(path):
    print(path) # Example

btncmd = read_all_file(path = 1):
>> Number 1 Output
btn1 = Button(root, width=20, height=100, command=btncmd)
btn1.pack()


2022-09-20 17:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.