combobox method tkinter code example

Example 1: chech box in tkinter

from tkinter import *
master = Tk()
var1 = IntVar()
Checkbutton(master, text="male", variable=var1).grid(row=0, sticky=W)
var2 = IntVar()
Checkbutton(master, text="female", variable=var2).grid(row=1, sticky=W)
mainloop()

Example 2: list in tkinter messagebox

from tkinter import *
from tkinter import messagebox

def listMessageBox(arr):
  window=Tk()
  listbox=Listbox(window)
  listbox.pack(fill=BOTH, expand=1) #adds listbox to window
  [listbox.insert(END, row) for row in arr] #one line for loop
  window.mainloop()
  
arr=['a','b','c','1','2','3']

listMessageBox(arr)