-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathlistComp.py
25 lines (23 loc) · 930 Bytes
/
listComp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from tkinter import *
from tkinter.ttk import *
from db import DBConnect
import sqlite3
class ListComp:
def __init__(self):
self._dbconnect = DBConnect()
self._dbconnect.row_factory = sqlite3.Row
self._root = Tk()
self._root.title('List of Complaints')
tv = Treeview(self._root)
tv.pack()
tv.heading('#0', text='ID')
tv.configure(column=('#Name', '#Gender', '#Comment'))
tv.heading('#Name', text='Name')
tv.heading('#Gender', text='Gender')
tv.heading('#Comment', text='Comment')
cursor = self._dbconnect.ListRequest()
for row in cursor:
tv.insert('', 'end', '#{}'.format(row['ID']), text=row['ID'])
tv.set('#{}'.format(row['ID']), '#Name', row['Name'])
tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
tv.set('#{}'.format(row['ID']), '#Comment', row['Comment'])