Click here to Skip to main content
15,887,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently creating a top down shooter in pygame and need a video as the background for my main menu. Currently I have a video that plays but it creates a new display rather than putting the video in my game menu background. 

# Video
    class VideoWindow(App):
            def build(self):
                video = Video(source = 'MenuVideo.mp4')
                video.state = "play"
                video.options = {'eos':'loop'}
                video.allow_stretch = True
                return video
    
    if __name__ == "__main__":
        background_menu = VideoWindow()
        background_menu.run()
    

# Menu
    def main_menu():
    
        click = False
        font2 = pygame.font.Font('Pixel.TTF', 64)
        keys = pygame.key.get_pressed()
        play_menu = pygame.image.load('Play.png')
        options_menu = pygame.image.load('Options.png')
        quit_menu = pygame.image.load('Quit.png')
    
        while True:
            draw_text = font2.render('MAIN MENU', (255, 255, 255),True)
    
            mx, my = pygame.mouse.get_pos()
    
    
            button1 = pygame.Rect(50, 100, 200, 50)
            button2 = pygame.Rect(50, 200, 200, 50)
    
            if button1.collidepoint ((mx, my)):
                if click:
                    game()
            if button2.collidepoint ((mx, my)):
                if click:
                    options()
            pygame.draw.rect(display, (0, 0, 139), button1)
    
            pygame.draw.rect(display, (0, 0, 139), button2)
            Button1text = True
            button1text_menu(ButtonX, ButtonY)
    
            click = False
            keys = pygame.key.get_pressed()
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()
                if keys[pygame.K_ESCAPE]:
                    pygame.quit()
                    sys.exit()
                if event.type == pygame.MOUSEBUTTONDOWN:
                    if event.button == 1:
                        click = True
            pygame.display.update()
            clock.tick(60)
    main_menu()


What I have tried:

I have tried a tonne of tutorials and searched online but nothing has come up.
Posted
Updated 2-Sep-22 1:59am

1 solution

I think you will get better help with your questions at https://www.pygame.org/news[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900