Jump to content

Title and loading

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Faith2011

Faith2011

    Newbie

  • Members
  • Pip
  • 2 posts
Hi all, this is my first day on this forum, I am developing a game in pygame and like to know how to put a title into this game by the use of DEF statement that does not effect the main game structure and clears the screen after a user input a key I have not shown any coding from game.

Also I am having problem with loading pgn,jpegs, wave from my computer into pygame, keep getting traceback error, image will not open corectly. Used os, oscwd, load.image and so on !!! I would welcome any suggestion on the above things..Thankyou for time .


#2
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 890 posts
You can set caption (title) with set_caption function. Also, post your traceback log of your errors with loading, maybe the answer is hidden in there. ;)
A conclusion is where you got tired of thinking.
#define class struct    // All is public.

#3
Faith2011

Faith2011

    Newbie

  • Members
  • Pip
  • 2 posts
Thanks for reply Flying Dutchman but I am not talking about pygame.display.set_caption which is easy to understand. More along the lines of Intro screen Like this sorry misunderstanding.

    def IntroScreen():   

    pygame.init()

    screen = pygame.display.set_mode((1000,650))

    pygame.display.set_caption('Instructions')

    clock = pygame.time.Clock()

    background = pygame.Surface(screen.get_size())

    background = background.convert()

    background.fill((0,0,160))

    Font = pygame.font.SysFont('Vedana',30,True)

    Font1 = pygame.font.SysFont('Vedana',15,True)

    IntroText = Font.render('BASIC INSTRUCTIONS',0,(255,255,0))

    Press = Font.render('Press enter to continue',0,(255,255,255))

    Run = True

    Intro = True

    while Intro:

        for event in pygame.event.get():

            if event.type == pygame.QUIT:

                Run = False

                Intro = False

            elif event.type == pygame.KEYDOWN:

                if event.key == pygame.K_RETURN:

                   Intro = False 

        screen.blit(background, (0,0))

        screen.blit(IntroText,(400,15))

        screen.blit(Press,(400,600))

        pygame.display.flip()

        clock.tick(30)

    while Run:

       for event in pygame.event.get():

          if event.type == pygame.QUIT:

             Run =False

        # screen.blit(background, (0,0))

       # screen.blit(Text, (100,100))                

    pygame.display.flip()

    clock.tick(150)

    pygame.quit()

Edited by Roger, 10 January 2011 - 09:19 PM.
wrapped code tag