How to run a command function based on ComboBox?

Good day, prompt, please, there is an element of the Combobox
formatBtn = {'PNG':'pngFiles', 'JPEG':'jpegFiles'}

listFormat = [u 'PNG', u 'JPEG']

cb_1 = ttk.Combobox(root, values=listFormat)

button_1 = Button(root, text="Convert")
button_1.grid(row=2, column=1, sticky=(N, S, W, E), command=formatBtn[cb_1.get()])

Clicking on button want to run a function. Tell me, please.
March 19th 20 at 09:11
0 answer

Find more questions by tags TkinterPython