Example #1
0
 def rules_btn_click(self, **event_args):
     """
     Entire application is restarted, thereby reverting the
     player back to the rules/landing page.
     """
     self.restart_btn.enabled = False
     self.rules_btn.enabled = False
     routing.set_url_hash("")
     routing.reload_page(hard=True)
Example #2
0
    def button_1_click(self, **event_args):
        name = self.name_box.text.strip()
        #"".join(list(filter(None, self.name_box.text.split(" "))))
        if name:
            pos = anvil.server.call(
                "record_score",
                name,
                source_word,
                record_time,
                ", ".join(word_matches),
            )
            # route is set to the top10 form and performs a hard refresh.
            routing.set_url_hash(f"top10?position={pos}",
                                 replace_current_url=True,
                                 redirect=True)

            routing.reload_page(hard=True)
        else:
            self.name_box.text = ""
            self.name_box.placeholder = "You must enter your name to submit a score."
            self.name_box.focus()
Example #3
0
 def start_btn_click(self, **event_args):
     """This method is called when the button is clicked"""
     self.start_btn.enabled = False
     routing.set_url_hash(
         "NewGame", replace_current_url=False, redirect=True
     ) 
Example #4
0
 def restart_btn_click(self, **event_args):
     routing.set_url_hash("", replace_current_url=False, redirect=True)
Example #5
0
 def play_game_btn_click(self, **event_args):
     routing.set_url_hash("NewGame",
                          replace_current_url=False,
                          redirect=True)