From 22889e2c42bf33523b1ddff82d555ad144c56289 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 6 Apr 2024 11:04:27 -0400 Subject: tk: add tooltip for breakables --- srb_tk.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/srb_tk.py b/srb_tk.py index 607daa8..7f64e87 100755 --- a/srb_tk.py +++ b/srb_tk.py @@ -155,14 +155,12 @@ class App(tk.Frame): self.level_letters = [] statuses = [i["name"] for i in srb_lib.LEVEL_STATUSES] statuses_hex = [i["b"] for i in srb_lib.LEVEL_STATUSES] - self.level_breakables = [] for i in range(0,len(srb_lib.LEVELS)): self.level_strs.append(tk.StringVar(value=srb_lib.get_level_info(i)[0]["name"])) self.level_statuses_hex.append(tk.StringVar(value=statuses_hex[0])) self.level_statuses.append(tk.StringVar(value=statuses[0])) self.level_balloons.append(tk.IntVar()) self.level_letters.append(tk.IntVar()) - self.level_breakables.append(tk.IntVar()) # END DATA VARIABLES # statusbar variable @@ -277,6 +275,7 @@ class App(tk.Frame): self.btn_letters_all = [] self.btn_levels_breakables = [] self.bim_levels_breakables = [] + self.ttp_levels_breakables = [] self.img_balloons = [] self.img_breakables = [] self.BREAKABLES = sorted(srb_lib.BREAKABLES,key=lambda i: i["w"]) @@ -345,6 +344,7 @@ class App(tk.Frame): # and now all of a sudden it does pixels. self.btn_levels_breakables[-1].config(width=88,image=self.bim_levels_breakables[-1]) self.btn_levels_breakables[-1].grid(row=x,column=16) + self.ttp_levels_breakables.append(stk.Tooltip(self.btn_levels_breakables[-1])) x += 1 # end for-j-in-levels x += 1 @@ -747,6 +747,7 @@ class App(tk.Frame): if self.bim_levels_breakables[y] != -1: # which really means, if IMAGES self.btn_levels_breakables[y].config(image=self.bim_levels_breakables[y]) self.btn_levels_breakables[y].config(text=str(len(b_list))) + self.ttp_levels_breakables[y].text = b_str # y counts number of levels with breakables y = y + 1 # end of if-level-has-breakables -- cgit