Thomas Kilian Thomas Kilian - 1 year ago 91
Python Question

ComboBox not present in TK

According to the docs there should be a

operation in TK, but I can't find it.

['ACTIVE', 'ALL', 'ANCHOR', 'ARC', 'At', 'AtEnd', 'AtInsert', 'AtSelFirst', 'AtSelLast', 'BASELINE', 'BEVEL', 'BOTH', 'BOTTOM', 'BROWSE', 'BUTT', 'BaseWidget', 'BitmapImage', 'BooleanType', 'BooleanVar', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'Button', 'CASCADE', 'CENTER', 'CHAR', 'CHECKBUTTON', 'CHORD', 'COMMAND', 'CURRENT', 'CallWrapper', 'Canvas', 'Checkbutton', 'ClassType', 'CodeType', 'ComplexType', 'DISABLED', ...

The version is

import Tkinter as tk

'$Revision: 81008 $'

on my Mac (latest OS X 10.11.6). No brewery for python whatsoever.

Answer Source

There is no ComboBox widget in tkinter, what you are looking for is tkinter.ttk (in Python 3, in Python 2 it's just called ttk), which provides themed tk widgets. Docs for tkinter.ttk, and subsection for ComboBox.

You can use this code to import ttk and use its widgets rather than standard tkinter ones:

Python 2

from Tkinter import *
from ttk import *

Python 3:

from tkinter import *
from tkinter.ttk import *
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download