Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between OtpionMenu and ComboBox in tkinter

Tags:

python

tkinter

I was wondering what is the difference between ComboBox and OptionMenu widgets in python tkinter. It seems that they allow to do the same thing, but Combobox is only available in ttk.

Does anyone could explain the difference?

Thanks

like image 391
BayesianMonk Avatar asked Jul 17 '18 13:07

BayesianMonk


1 Answers

The OptionMenu is a button with a menu attached. The menu typically grows in height until it reaches the edge of the screen. The choices are fixed, and the user can't type in their own value.

A Combobox is in effect an Entry widget with a dropdown listbox. The user has the ability (if properly configured) to type into the combobox or pick from the dropdown list. The dropdown list is typically constrained to a handful of rows, with a scrollbar when the list gets to long to fit.

The Combobox is also a bit easier to add and remove items after the widget has been created. The OptionMenu was designed to have a static number of items that are set when the widget is created.

like image 84
Bryan Oakley Avatar answered Oct 17 '22 18:10

Bryan Oakley