Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
chang-yichen committed Sep 21, 2021
1 parent 8421ffe commit 963e218
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 58 deletions.
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class App(Tk):
def __init__(self):
Tk.__init__(self)
self._frame = None
self.switch_frame(Past_Purchase_Page)
#self.switch_frame(Past_Purchase_Page)
self.switch_frame(customerItem_Page)

def switch_frame(self, frame_class):
new_frame = frame_class(self)
Expand Down
27 changes: 11 additions & 16 deletions customerItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ class customerItem_Page(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.master = master

def show():
conn = sqlite3.connect('products.db')
getProducts()

c = conn.cursor()

c.execute('''
SELECT * FROM products
''', [''])

for product in c.fetchall():
print(product)

conn.commit()
conn.close()

filter_btn = Button(self, text="FILTER", command = show)
def getProducts():
my_conn = sqlite3.connect('products.db')
r_set=my_conn.execute('''SELECT * from products''');
i=0 # row value inside the loop
for product in r_set:
for j in range(len(product)):
e = Entry(self, width=10, fg='blue')
e.grid(row=i, column=j)
e.insert(END, product[j])
i=i+1
6 changes: 3 additions & 3 deletions data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
INSERT INTO products VALUES (?,?,?,?,?,?)
''',
[row['Category'],
row['Cost ($)'],
row['Cost'],
row['Model'],
row['Price ($)'],
row['Price'],
row['ProductID'],
row['Warranty (months)']]
row['Warranty']]
)

# cursor.execute('''
Expand Down
36 changes: 0 additions & 36 deletions product_data.py

This file was deleted.

Binary file modified products.db
Binary file not shown.
4 changes: 2 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sqlite3

connection = sqlite3.connect('items.db')
connection = sqlite3.connect('products.db')
cursor = connection.cursor()
cursor.execute('SELECT * FROM products WHERE ItemID < 1005')
cursor.execute('SELECT * FROM products')
print(cursor.fetchall())

0 comments on commit 963e218

Please sign in to comment.