def helppage2(): pygame.init() Quit = False inv = False inv1 = False page = 1 background2 = pygame.image.load(os.path.join(FILEPATH, 'Fonts', 'Help2.png')) prevpage = button((0, 0, 0), 1440, 350, 75, 100, FILEPATH, (0, 0, 0), text='<') while not Quit: for event in pygame.event.get(): pos = pygame.mouse.get_pos() if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: return True if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: if prevpage.isOver(pos): page = 1 helppage() if event.type == pygame.MOUSEMOTION: if prevpage.isOver(pos): inv1 = True else: inv1 = False WIN.blit(background2, (0, 0)) fillhelp(inv1, prevpage)
def helppage(k=False): if k: return pygame.init() Quit = False inv = False background1 = pygame.image.load(os.path.join(FILEPATH, 'Fonts', 'Help1.png')) nextpage = button((0, 0, 0), 1440, 350, 75, 100, FILEPATH, (0, 0, 0), text='>') while not Quit: if k: return for event in pygame.event.get(): pos = pygame.mouse.get_pos() if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: return if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: if nextpage.isOver(pos): k = helppage2() continue if event.type == pygame.MOUSEMOTION: if nextpage.isOver(pos): inv = True else: inv = False WIN.blit(background1, (0, 0)) fillhelp(inv, nextpage)
def mainpage(): Quit = False pygame.init() invp = False invs = False invh = False pygame.display.set_caption("Visualiser: Main Page") platbtn = button((0, 0, 0), 175 + 270, 500, 200, 100, FILEPATH, (0, 0, 0), text='Maze') sortbtn = button((0, 0, 0), 385 + 270, 500, 200, 100, FILEPATH, (0, 0, 0), text='Sort') helpbtn = button((0, 0, 0), 595 + 270, 500, 200, 100, FILEPATH, (0, 0, 0), text='Help') while not Quit: WIN.fill(GREY) filltext(invp, platbtn, invs, sortbtn, invh, helpbtn) for event in pygame.event.get(): pos = pygame.mouse.get_pos() if event.type == pygame.QUIT: Quit = True if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: if platbtn.isOver(pos): pygame.display.set_caption("Visualiser: Edit") Quit = Visualiser.main() invp = False if sortbtn.isOver(pos): pygame.display.set_caption("Visualiser: Help") Quit = sort.sortloop() invs = False if helpbtn.isOver(pos): pygame.display.set_caption("Visualiser: Help") Quit = helppage() invh = False if event.type == pygame.MOUSEMOTION: if platbtn.isOver(pos): invp = True else: invp = False if sortbtn.isOver(pos): invs = True else: invs = False if helpbtn.isOver(pos): invh = True else: invh = False pygame.display.update()