How to create a combobox that includes checkbox for each item?
Question: Fairly new to tkinter and python I was wondering how to achieve a button that
would act like this :

  * Click on button drops down a list (so that's a combobox)
  * Each line of the list has a checkbox. 
  * Finally if a checkbox is clicked run a function, or (even better) once combobox is no more dropped run a function with items checked as args. 

**UPDATE**

The button/menuButton will have to act like a filter. When menu is dropped
down user can uncheck multiple options (without the menu to disappear each
time an item is clicked) he don't want. Therefore it's really important to be
able to see checkboxes so as the user know which options are currently active.

I finally used the idea of Bryan by creating a top level frame. Here is what I
have :

![](http://i.stack.imgur.com/HGf8W.png)


Answer: I don't think the `OptionMenu` is intended to hold anything but strings. It
sounds like you want the functionality of a
[Listbox](http://effbot.org/tkinterbook/listbox.htm), which has options to
allow for multiple selections, get all selected items, and so on.

This gives you an `OptionMenu` with _checkboxes_ in the contained Menu. Check
whichever items you like, then right-click in the tkinter window to print the
values of the checkboxes to the console.

    
    
    from tkinter import *
    
    master = Tk()
    
    var = StringVar(master)
    var.set("Check")
    w = OptionMenu(master, variable = var, value="options:")
    w.pack()
    first = BooleanVar()
    second = BooleanVar()
    third = BooleanVar()
    w['menu'].add_checkbutton(label="First", onvalue=True, 
                              offvalue=False, variable=first)
    w['menu'].add_checkbutton(label="Second", onvalue=True, 
                              offvalue=False, variable=second)
    w['menu'].add_checkbutton(label="Third", onvalue=1, 
                              offvalue=False, variable=third)
    
    
    master.bind('<Button-3>', lambda x: print("First:", first.get(), " Second:", 
               second.get(), " - Third:", third.get()))
    mainloop()
    

See also [this](http://stackoverflow.com/questions/3929355/making-menu-
options-with-checkbutton-in-tkinter-python).

