Dynamically change combobox size Python Tkinter
<p>In Python Tkinter is it possible to dynamically change the size of a <code>combobox</code> (the width of the entry widget) based on the length of the selected item?</p>

<p>Is this what you are looking for:</p>

<pre><code>from tkinter import *
import ttk
root = Tk()

defaultCar = StringVar()
defaultCar.set("Mercedes Benz")

carList = ["BMW", "Lamborghini", "Honda"]

def resizeFunc():
    newLen = len(cars.get())
    cars.configure(width=newLen+2)

cars = ttk.Combobox(root,
                    textvariable=defaultCar,
                    values=carList,
                    postcommand=resizeFunc)
cars.pack()
</code></pre>

<p>?</p>

python tkinter combobox width dynamically-generated