diff options
author | B. Stack <bgstack15@gmail.com> | 2024-05-02 15:39:09 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2024-05-02 15:39:09 -0400 |
commit | f4dc5f5bc25058b791756680f40e4c2fa5f647ef (patch) | |
tree | 5f330360f249f1d5eabf8b18e3cc771630d84023 /srb_tk.py | |
parent | tk: add background color for levelsets (diff) | |
download | srb_lib-f4dc5f5bc25058b791756680f40e4c2fa5f647ef.tar.gz srb_lib-f4dc5f5bc25058b791756680f40e4c2fa5f647ef.tar.bz2 srb_lib-f4dc5f5bc25058b791756680f40e4c2fa5f647ef.zip |
tk: improve bg colors for labels in levelset area
Diffstat (limited to 'srb_tk.py')
-rwxr-xr-x | srb_tk.py | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -301,27 +301,30 @@ class App(tk.Frame): self.img_balloons.append(get_srb_image("balloon-none.png",16,20)) elif tl["c"] and tl["c"] != "none": self.img_balloons.append(get_srb_image("balloon-" + tl["c"] + ".png",16,20)) + # set background color for this levelset + tl_bg = self.background_color + if "c" in tl and tl["c"] != "none": + tl_bg = "#" + hex(colors[tl["c"]])[2:] + tk.Label(self.frm_levels,background=tl_bg).grid(row=x,column=0,rowspan=tl["l"],columnspan=17,sticky="NESW") + tk.Label(self.frm_levels,image=self.img_balloons[-1],background=tl_bg).grid(row=x,column=2,columnspan=2) #self.lbl_levelsets.append(tk.Label(self.frm_levels,text=tl["name"],image=self.img_balloons[-1],compound="right")) - self.lbl_levelsets.append(tk.Label(self.frm_levels,text=tl["name"])) + self.lbl_levelsets.append(tk.Label(self.frm_levels,text=tl["name"],background=tl_bg)) self.lbl_levelsets[i].grid(row=x,column=0,sticky="EW",columnspan=2) - if "c" in tl and tl["c"] != "none": - tk.Label(self.frm_levels,background="#" + hex(colors[tl["c"]])[2:]).grid(row=x,column=0,rowspan=tl["l"],columnspan=17,sticky="NESW") - tk.Label(self.frm_levels,image=self.img_balloons[-1]).grid(row=x,column=2,columnspan=2) self.spn_levelsets.append(stk.Spinbox(self.frm_levels,textvariable=self.levelset_status_ints[i],from_=0,to=tl["l"],width=2)) self.spn_levelsets[i].grid(row=x+1,column=0) - tk.Label(self.frm_levels,text="/ " + str(tl["l"])).grid(row=x+1,column=1,sticky="EW") + tk.Label(self.frm_levels,text="/ " + str(tl["l"]),justify="left",background=tl_bg).grid(row=x+1,column=1) # balloons per levelset if "c" in tl and tl["c"] != "none": self.ent_levelsets_balloons.append(tk.Entry(self.frm_levels,textvariable=self.levelset_balloons_ints[i],state="readonly",width=3)) self.ent_levelsets_balloons[-1].grid(row=x+1,column=2) - tk.Label(self.frm_levels,text="/" + str(tl["b"])).grid(row=x+1,column=3,sticky="E") + tk.Label(self.frm_levels,text="/" + str(tl["b"]),background=tl_bg).grid(row=x+1,column=3,sticky="E") #print(f"For levelset {tl},") these_levels = [k for k in srb_lib.LEVELS if k["setid"] == tl["id"]] sorted(these_levels,key=lambda i: i["id"]) y = 0 for j in these_levels: #print(f"Process level {j}") - self.lbl_levels.append(tk.Label(self.frm_levels,text=j["name"])) + self.lbl_levels.append(tk.Label(self.frm_levels,text=j["name"],background=tl_bg)) self.lbl_levels[-1].grid(row=x,column=5) self.opt_levels_hex.append(tk.Entry(self.frm_levels,state="readonly",textvariable=self.level_statuses_hex[j["id"]],width=2)) self.opt_levels_hex[-1].grid(row=x,column=6) @@ -332,7 +335,7 @@ class App(tk.Frame): if j["b"]: self.ent_levels_balloons.append(tk.Entry(self.frm_levels,state="readonly",textvariable=self.level_balloons[j["id"]],width=2)) self.ent_levels_balloons[-1].grid(row=x,column=8) - tk.Label(self.frm_levels,text="/ " + str(j["b"])).grid(row=x,column=9) + tk.Label(self.frm_levels,text="/ " + str(j["b"]),background=tl_bg).grid(row=x,column=9) self.btn_balloons_none.append(tk.Button(self.frm_levels,text="none",padx=0,pady=0,command=lambda tl=j,action="none",ty="balloons": self.button_action_level(tl,action,ty))) self.btn_balloons_none[-1].grid(row=x,column=10) self.btn_balloons_all.append(tk.Button(self.frm_levels,text="all",padx=0,pady=0,command=lambda tl=j,action="all",ty="balloons": self.button_action_level(tl,action,ty))) @@ -340,7 +343,7 @@ class App(tk.Frame): # every level has letters though self.ent_levels_letters.append(tk.Entry(self.frm_levels,state="readonly",textvariable=self.level_letters[j["id"]],width=2)) self.ent_levels_letters[-1].grid(row=x,column=12) - tk.Label(self.frm_levels,text="/ " + str(len(str(j["l"])))).grid(row=x,column=13) + tk.Label(self.frm_levels,text="/ " + str(len(str(j["l"]))),background=tl_bg).grid(row=x,column=13) self.btn_letters_none.append(tk.Button(self.frm_levels,text="none",padx=0,pady=0,command=lambda tl=j,action="none",ty="letters": self.button_action_level(tl,action,ty))) self.btn_letters_none[-1].grid(row=x,column=14) self.btn_letters_all.append(tk.Button(self.frm_levels,text="all",padx=0,pady=0,command=lambda tl=j,action="all",ty="letters": self.button_action_level(tl,action,ty))) |