[Tkinter-discuss] Combobox - global var not found

Igor Novikov igor.e.novikov at gmail.com
Mon Apr 19 20:47:48 CEST 2010


Hi,

Please note that Combobox widget is a Tile widget. To instantiate this
object
you should import that from ttk module.

Here is a code from your reference link:

countryvar = StringVar()
country = *ttk*.Combobox(*parent*, textvariable=countryvar)

Regards,

Igor Novikov
sK1 Project
http://sk1project.org


On Mon, Apr 19, 2010 at 6:25 AM, kimmyaf <flahertyk1 at hotmail.com> wrote:

>
> I am experimenting with TKinter for the first time for my programming
> course.
> Trying to get a combobox working. At this point I'm not trying to write
> elegant code, but at least get it to work for now.
>
> I keep getting the error below. Shouldnt It recognize the Combobox widget
> from the import?
>
> "NameError: global name 'Combobox' is not defined"
>
> I'm sure there is something really obvious going on but I've been starting
> at it forever and not finding it. I've been using this as reference.
>
> http://www.tkdocs.com/tutorial/widgets.html
> http://www.tkdocs.com/tutorial/widgets.html
>
> I have the import line
> from TKinter import *
>
> #Combo box
>        combovar = StringVar()
>        self.combo = Combobox(self.frame, textvariable=combovar)
>        self.combo['values'] = get_available_routes()
>        self.combo.var = combovar
>        self.combo.bind('<<ComboboxSelected>>', self.get_locations)
>        self.combo.grid(row=0, column=2)
>
> --
> View this message in context:
> http://old.nabble.com/Combobox----global-var-not-found-tp28286729p28286729.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20100419/7dced1d9/attachment.html>


More information about the Tkinter-discuss mailing list