app/search_page.py
def find_fighter(self):
        """Main function that dispose next steps in searching for a fighter.
           If we've got him in the base - return information about it.
           If not - ask the user if he wants to start searching for him."""

        fighter = self.name_entry.get().upper()
        search = True
        if not fighter:
            messagebox.showerror(title="Error!", message="Field can't be empty!")
        elif len(fighter) <= 3:
            messagebox.showerror(title="Error!", message="Name is too short!")
        elif fighter:
            for fighter_name in self.fighters_list.get(0, END):
                if fighter in fighter_name:
                    fighter_index = fighter_name.split('.')[0]
                    messagebox.showinfo(
                        title="Success!",
                        message=f"Fighter has been successfully found in our\n"
                                f"database on {fighter_index} position!"
                    )
                    search = False
                    break

            if search:
                mbox = messagebox.askquestion(
                    title="Search",
                    message="Fighter hasn't been found in our database.\n"
                            "Would You like to search him?\n"
                            "(it may take at most 30 seconds)")
                if mbox == 'yes':
                    # global start_time
                    # start_time = time.perf_counter()
                    # # we have to spawn a new process, otherwise Tkinter will get a crash
                    # background_finding_process = Thread(
                    #     target=self.add_fighter, args=[fighter]
                    # )
                    # background_finding_process.start()

                    # -------------------------------------------------------------
                    # created in case of github
                    messagebox.showinfo(
                        title='Info',
                        message="Due to the site's rights, I cannot share the "
                                "full searching algorithm. Instead, I encourage "
                                "You guys to have a look on a video & photos to "
                                "see how it is working in a real time (presentation dir).")
Main function that dispose next steps in searching for a fighter.
           If we've got him in the base - return information about it.
           If not - ask the user if he wants to start searching for him.
Main function that dispose next steps in searching for a fighter.
If we've got him in the base - return information about it.
If not - ask the user if he wants to start searching for him.
Main function that dispose next steps in searching for a fighter . If we ' ve got him in the base - return information about it . If not - ask the user if he wants to start searching for him .
def find_fighter(self):
        fighter = self.name_entry.get().upper()
        search = True
        if not fighter:
            messagebox.showerror(title="Error!", message="Field can't be empty!")
        elif len(fighter) <= 3:
            messagebox.showerror(title="Error!", message="Name is too short!")
        elif fighter:
            for fighter_name in self.fighters_list.get(0, END):
                if fighter in fighter_name:
                    fighter_index = fighter_name.split('.')[0]
                    messagebox.showinfo(
                        title="Success!",
                        message=f"Fighter has been successfully found in our\n"
                                f"database on {fighter_index} position!"
                    )
                    search = False
                    break
            if search:
                mbox = messagebox.askquestion(
                    title="Search",
                    message="Fighter hasn't been found in our database.\n"
                            "Would You like to search him?\n"
                            "(it may take at most 30 seconds)")
                if mbox == 'yes':
                    messagebox.showinfo(
                        title='Info',
                        message="Due to the site's rights, I cannot share the "
                                "full searching algorithm. Instead, I encourage "
                                "You guys to have a look on a video & photos to "
                                "see how it is working in a real time (presentation dir).")
def find_fighter ( self ) : fighter = self . name_entry . get ( ) . upper ( ) search = True if not fighter : messagebox . showerror ( title = "Error!" , message = "Field can't be empty!" ) elif len ( fighter ) <= 3 : messagebox . showerror ( title = "Error!" , message = "Name is too short!" ) elif fighter : for fighter_name in self . fighters_list . get ( 0 , END ) : if fighter in fighter_name : fighter_index = fighter_name . split ( '.' ) [ 0 ] messagebox . showinfo ( title = "Success!" , message = f"Fighter has been successfully found in our\n" f"database on {fighter_index} position!" ) search = False break if search : mbox = messagebox . askquestion ( title = "Search" , message = "Fighter hasn't been found in our database.\n" "Would You like to search him?\n" "(it may take at most 30 seconds)" ) if mbox == 'yes' : messagebox . showinfo ( title = 'Info' , message = "Due to the site's rights, I cannot share the " "full searching algorithm. Instead, I encourage " "You guys to have a look on a video & photos to " "see how it is working in a real time (presentation dir)." )
Main function that dispose next steps in searching for a fighter.
Main function that dispose next steps in searching for a fighter .
"""Main function that dispose next steps in searching for a fighter.
           If we've got him in the base - return information about it.
           If not - ask the user if he wants to start searching for him.""" # global start_time # start_time = time.perf_counter() # # we have to spawn a new process, otherwise Tkinter will get a crash # background_finding_process = Thread( #     target=self.add_fighter, args=[fighter] # ) # background_finding_process.start() # ------------------------------------------------------------- # created in case of github
self