From 7f192894057b4825efa65c993ee028991474f441 Mon Sep 17 00:00:00 2001 From: CensoredUsername Date: Mon, 31 Jul 2017 18:12:11 +0200 Subject: [PATCH] Disable changing the cost of empty slots. Fixes #4 --- chips_UI.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chips_UI.py b/chips_UI.py index 2bf5259..172f6c3 100644 --- a/chips_UI.py +++ b/chips_UI.py @@ -62,18 +62,21 @@ def populate(self, parent): else: chip_cb.current(0) size_cb.current(0) + size_cb.config(state=tk.DISABLED) data = (row, chip_name, chip_size) - chip_cb.bind("<>", lambda e, args=data: self.on_chip_cb_selected(e, args)) + chip_cb.bind("<>", lambda e, args=data, size_cb=size_cb: self.on_chip_cb_selected(e, args, size_cb)) size_cb.bind("<>", lambda e, args=data: self.on_size_cb_selected(e, args)) - def on_chip_cb_selected(self, event, args): + def on_chip_cb_selected(self, event, args, size_cb): # print("index:{0} name:{1} size:{2}".format(args[0], args[1].get(), args[2].get())) if args[1].get() != "(Empty)": record = chips.ChipsRecord.from_name(args[1].get()) args[2].set(str(record.size)) + size_cb.config(state=tk.NORMAL) else: record = chips.ChipsRecord.EMPTY_RECORD args[2].set("0") + size_cb.config(state=tk.DISABLED) self.updated_chips[args[0]] = record def on_size_cb_selected(self, event, args):