How to insert into listbox using wxPython

Andrew na
Fri Jan 9 21:10:28 CET 2004

Hi thanks for your help but I am still having problems basically I am using
a button to connect to a Database and I want to display the data from the
database into the listbox
Here is the code I am using for the button

    def OnB2Button(self, event):
        self.db = MySQLdb.connect("localhost", "", "", "guestbook")
        global db
        self.c = self.db.cursor()
        self.c.execute("SELECT * FROM guests;")
        self.results = self.c.fetchall()
        # Here is where I don't know what to do I want to be able to get the
data from self.results and display it in the listbox
        print self.listbox.GetSelections()
        self.sizer.Add(self.listbox, 0, wxEXPAND)

Thank you again for your help



More information about the Python-list mailing list