'How do i convert multiple files using this askopenfilenames?

convert multipledocfiles to pdf code can convert but only one file

win.title("Word to PDF")
def openfile():
    indic = os.getcwd()
    file_type = [("Word files",'*docx')]
    file = askopenfilenames(initialdir=indic,filetypes=file_type)
    for doc in file:
        if doc.endswith('.docx'):
             convert(doc)


label = tk.Label(win,text = "Choose folder")
label.grid(row = 0,column = 0 ,pady = 5)
button = ttk.Button(win,text = "Select",width = 30, command = openfile)
button.grid(row =0 ,column= 1, padx=5, pady= 5)

win.mainloop() ```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source