My program needs to count and display the number of available assets from the inventory on Tkinter Treeview. The way I did to print the equipment type column on the GUI(last image) was using the SELECT from the EQUIPMENT TYPE query which lists the 11 rows from Equipment type table shown on the GUI. Subsequently, I need to print the total, unavailable, and available items for each equipment type. For example, if there's a total of 10 INTEGRATED PANEL, 3 are available, 7 are unavailable. What is the most easiest and efficient way to accomplish this? The code fragment below is used to insert the Equipment types into the GUI.It was easier to list the equipment types because it was just one column of from the table. For the availability, I'm couldn't imagine an easier way to do it. Thanks.
command = "SELECT `Equipment Type` FROM `Equipment Types`"
mycursor.execute(command)
results = mycursor.fetchall()
for i in range(len(results)):
results[i] = list(results[i])
tree.insert("", "end", str(results[i][0]), text = str(results[i][0]), tag = [[i][0]], open = TRUE)







def refresh_clicked(self):
self.destroy()
self.__init__()
button_refresh = tk.Button(topframe, text = "Refresh", state = NORMAL, command = self.timed_refresh)
button_refresh.grid(row = 1, column = 2, sticky = W, padx = 5, pady = 2)
COUNT()function for SQL.