def start_gui(process):
"""
A function that takes care of starting the GUI and stops the Scrapy crawler process when exited from program.
:param CrawlerProcess process: The scrapy crawler process that is used to scrape the web. The instance is used for stopping the process.
"""
def create_ui(screen):
"""
A function passes to curses wrapper for safe execution of terminal GUI.
:param screen: The screen parameter to run the GUI. Sent from the curses wrapper.
"""
GUI.screen = screen # All the statis variables of the GUI class is initialized
GUI.strings = [] # the list of songs is empty initially
GUI.init_display() # init the variables required for GUI
GUI.update_on_key() # Starts a loop that waits for key input and acts accordingly
curses.nocbreak()
curses.echo()
curses.endwin()
GUI.gui_stopped = True
curses.wrapper(create_ui)
process.stop() # Stopping the scrapy crawler process
评论列表
文章目录