Skip to content

Commit

Permalink
X button => Close(?)
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvaSambrani committed Mar 30, 2022
1 parent 63fda6a commit f4aade6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tetra/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def on_success_code_run(self, game):
print("Should eval now")
exec(compile(open(self.code_file, encoding="utf-8").read(), self.code_file, "exec"))



def render(self, game, collected=False):
win = sg.Window("Found an item!", layout=self.make_layout(collected), modal=True, keep_on_top=True, finalize=True)
win.bind("<Escape>", "Close")
Expand All @@ -67,11 +65,12 @@ def render(self, game, collected=False):
sg.popup_no_buttons("Incorrect!", auto_close = True, auto_close_duration = 1, no_titlebar = True, modal = True, background_color = "#4D4D4D")
win["in"].update(value = "", background_color="#4d4d4d")

elif event=="Close" and (not self.need_input or collected):
elif (event=="Close" or event is None) and (not self.need_input or collected):
self.perform_success(game, collected)
successful = True
break
else:
print(f"Unhandled Event: {event}!")
break
win.close()
return successful and self.collectable
Expand Down

0 comments on commit f4aade6

Please sign in to comment.