lundi 1 juin 2015

How to get rid of curly braces from expanded list

I'm new to Python, so please bear with me. I'm trying to populate an optionmenu with rows from an SQLite database. The problem is that when a cell contains a space, the option appears with {} around it. What is the proper way to do this?

from tkinter import *
import sqlite3

conn = sqlite3.connect('db_name.db')
c = conn.cursor()
c.execute('''SELECT client_name FROM clients
         ORDER BY client_name''')
clients = c.fetchall()

master = Tk()
variable = StringVar(master)
variable.set("Select Client")
client = OptionMenu(master, variable, *tuple(clients))

Aucun commentaire:

Enregistrer un commentaire