0

I have created file dialog window with tkinter and two different functions: one works with images, another with videos. How can I make tkinter button to call different functions when either of filetypes passed into file dialog.

1 Answers1

2

You can simply write a function that will check the extension and act accordigly:

def fun(filename):
    if filename.endswith(".txt"):
        fun_txt(filename)
    else:
        fun_doc(filename)
matszwecja
  • 6,357
  • 2
  • 10
  • 17