|
|
|
@ -1,5 +1,4 @@ |
|
|
|
from tkinter import * |
|
|
|
from decimal import Decimal as D |
|
|
|
|
|
|
|
class ButtonWithCheck: |
|
|
|
def __init__(self,root,name): |
|
|
|
@ -36,7 +35,7 @@ class Row: |
|
|
|
def __init__(self,root,info): |
|
|
|
self.root = root |
|
|
|
self.name = info['name'] |
|
|
|
self.price = D(info['price']) |
|
|
|
self.price = info['price'] |
|
|
|
self.count = info['count'] |
|
|
|
self.total = self.price * self.count |
|
|
|
|
|
|
|
@ -48,8 +47,8 @@ class Row: |
|
|
|
|
|
|
|
def grid(self,row_num): |
|
|
|
col = self.button.grid(row_num,0) |
|
|
|
col = self.label_count.grid(row_num,col) |
|
|
|
col = self.label_price.grid(row_num,col) |
|
|
|
col = self.label_count.grid(row_num,col) |
|
|
|
col = self.label_total.grid(row_num,col) |
|
|
|
|
|
|
|
def get_status(self): |
|
|
|
@ -58,7 +57,8 @@ class Row: |
|
|
|
class MainWindow: |
|
|
|
def __init__(self,prices): |
|
|
|
self.root = Tk() |
|
|
|
self.root.overrideredirect(True) |
|
|
|
self.root.wm_title("Today's Prices") |
|
|
|
self.root.protocol("WM_DELETE_WINDOW", self.root.quit) |
|
|
|
self.root.wm_attributes("-topmost", True) |
|
|
|
self.rows = sorted(map(lambda row: Row(self.root,row),prices),key = lambda r: r.name) |
|
|
|
offset = 0 |
|
|
|
@ -87,6 +87,7 @@ class MainWindow: |
|
|
|
) |
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
from decimal import Decimal as D |
|
|
|
info = [{'name': 'battery', 'link': 2, 'count': 4, 'purchased': 0, 'product_name': 'AHTECH Infinity 1300mah 14.8V 90C 4S1P Race', 'price': D('24.99'), 'time': '11:52:37.877501'}, {'name': 'charger', 'link': 6, 'count': 1, 'purchased': 0, 'product_name': 'Turnigy Reaktor 250W 10A 1-6S Balance Charger', 'price': D('52.88'), 'time': '15:05:16.120764'}, {'name': 'controller', 'link': 11, 'count': 1, 'purchased': 0, 'product_name': 'FrSky Taranis Q X7 2.4GHz 16CH Transmitter', 'price': D('104.99'), 'time': '15:26:24.942471'}, {'name': 'drone', 'link': 0, 'count': 1, 'purchased': 1, 'product_name': 'X215 PRO 215mm FPV Racing Drone BNF', 'price': D('212.35'), 'time': '11:41:46.865581'}, {'name': 'fpv', 'link': 7, 'count': 1, 'purchased': 1, 'product_name': 'Aomway Commander Goggles V1 FPV 2D 3D', 'price': D('299.00'), 'time': '15:09:55.486299'}, {'name': 'parallel_charger', 'link': 5, 'count': 1, 'purchased': 0, 'product_name': 'Paraboard Parallel Charging Board for Lipos with', 'price': D('19.99'), 'time': '15:04:41.003013'}, {'name': 'props', 'link': 4, 'count': 4, 'purchased': 0, 'product_name': 'DAL T5046 Cyclone Tri-Blade', 'price': D('2.79'), 'time': '15:03:59.716362'}, {'name': 'power_supply', 'link': 12, 'count': 1, 'purchased': 0, 'product_name': 'Turnigy Reaktor Pro 240W 16A Power Supply', 'price': D('34.29'), 'time': '15:27:19.812154'}] |
|
|
|
window = MainWindow(info) |
|
|
|
window.start() |