def close_open(self, y): """ Logic to load an account. :param y: string """ self.transaction_list = Data.load(str(y))["transactions"] self.categories = Data.load(str(y))["categories"] self.amounts = Data.load(str(y))["category_amounts"] self.s.set(str(y)) self.new_window.destroy() self.t.set("$" + str(Register.get_total(self.transaction_list))) self.display_list()
def add_two(self, x, y, z): """ Pass x, y, and z to the logic to create a new Transaction object. :param x: string :param y: string :param z: float """ self.count += 1 x = Transaction(self.count, x, y, datetime.today(), z) self.transaction_list.append(x) self.new_window.destroy() self.t.set("${0}".format(str(Register.get_total(self.transaction_list)))) self.display_list()
def delete_two(self, z): """ Logic to delete transaction with number z :param z: int """ x = None r = None for y in self.transaction_list: if y.number == int(z): x = y for y in self.labels: text = y.cget("text") assert isinstance(text, str) text = text.split("\t") if text[0] in str(z): r = y self.transaction_list.remove(x) self.labels.remove(r) self.new_window.destroy() self.t.set("${0}".format(str(Register.get_total(self.transaction_list)))) self.display_list()