Python Forum
Linking Comboboxes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linking Comboboxes
#16
(Jan-31-2021, 09:04 PM)MrP Wrote:
(Jan-31-2021, 04:34 PM)deanhystad Wrote: I am trying to determine if the problem is the query. If you execute this code what do you get? Does it return an empty list? If there are items in the list, what are the items? Are they tuples or lists?
def fill_addrbox():   # THIS DOES NOT WORK
              
    conn = sqlite3.connect("service.db")
    cur = conn.cursor()
              
    cur.execute("SELECT distinct addr FROM ticket WHERE cust = '%s'" % (self.cboCust.get(),))
    # self.cboAddr.delete(0, END)
    data = []
    for row in cur.fetchall():
        data.append(row[0])
        # self.cboAddr.insert('', row[0],)
        # print(row)
    return data
as it reads without binding it to an event I get no errors and a tuple is returned to the debug screen due to the print function in the 9th row and nothing is populated to the address combo text box
ok putting the *args in stopped a bunch of errors but it still is not populating the combo box!! the print function is printing the correct data to the debug screen. The functions for the fill_cust and fill_addr are identical with the exception that I'm trying to filter by the selection of the cust combobox, without the filter it will and does populate the addr combobox with all the addresses for all the customers. I don't know how to explain this any better, it JUST doesn't work when I use the WHERE statement.
I have tried: cur.execute("SELECT distinct addr FROM ticket WHERE cust = '%s'" % (self.cboCust.get(),))
I have tried: cur.execute("SELECT distinct addr FROM ticket WHERE cust = ?" , (self.cboCust.get(),))
nothing seems to work
Reply


Messages In This Thread
Linking Comboboxes - by MrP - Jan-24-2021, 05:08 PM
RE: Linking Comboboxes - by Larz60+ - Jan-24-2021, 06:49 PM
RE: Linking Comboboxes - by MrP - Jan-24-2021, 07:32 PM
RE: Linking Comboboxes - by Larz60+ - Jan-24-2021, 09:31 PM
RE: Linking Comboboxes - by MrP - Jan-30-2021, 01:35 PM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 04:09 AM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 11:41 AM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 02:14 PM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 04:10 PM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 04:34 PM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 09:04 PM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 09:41 PM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 09:45 PM
RE: Linking Comboboxes - by MrP - Jan-31-2021, 06:37 PM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 08:41 PM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 09:33 PM
RE: Linking Comboboxes - by deanhystad - Jan-31-2021, 10:12 PM
RE: Linking Comboboxes - by MrP - Feb-01-2021, 12:06 PM
RE: Linking Comboboxes - by deanhystad - Feb-01-2021, 03:04 PM
RE: Linking Comboboxes - by MrP - Feb-01-2021, 09:39 PM
RE: Linking Comboboxes - by deanhystad - Feb-01-2021, 10:41 PM
RE: Linking Comboboxes - by MrP - Feb-02-2021, 12:29 AM
RE: Linking Comboboxes - by deanhystad - Feb-02-2021, 01:03 AM
RE: Linking Comboboxes - by Serafim - Feb-02-2021, 09:06 AM
RE: Linking Comboboxes - by MrP - Feb-03-2021, 10:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't get tkinter database aware cascading comboboxes to update properly dford 6 3,776 Jan-11-2022, 08:37 PM
Last Post: deanhystad
  Print Values from a Sequence of Entries / ComboBoxes MC2020 4 2,889 Mar-28-2020, 10:05 PM
Last Post: MC2020
  [PyQt] making dependant comboBoxes Hitsugaya 3 5,107 May-23-2019, 06:05 PM
Last Post: Alfalfa

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020