python - Black screen when trying to create a menu -


i have problem. have made menu game making python (it more of start screen). however, when run code, see windows titled appropriately, screen black. doing wrong?

#importing libraries import pygame import sys import os  windowwidth = 640 windowheight = 480 #colour       r    g    b white     = (255, 255, 255) black     = (  0,   0,   0) red       = (255,   0,   0) green     = (  0, 255,   0) darkgreen = (  0, 155,   0) darkgrey  = ( 40,  40,  40) bgcolor = black  displaysurf = pygame.display.set_mode((windowwidth, windowheight))  pygame.init()  #drawing message def drawpresskeymsg():     presskeysurf = basicfont.render("press key play...", true, darkgrey)     presskeyrect = presskeysurf.get_rect()     presskeyrect.topleft = (windowwidth - 200, windowheight - 30)     displaysurf.blit(presskeysurf, presskeyrect)    #showing start screen def showstartscreen():     titlefont = pygame.font.font(none, 100)     titlemain = titlefont.render('badger defense', true, white, bgcolor)     titlesecond = titlefont.render("don't family killed!", true, green)  while true:     drawpresskeymsg()   #main function def main():     global displaysurf, basicfont      displaysurf = pygame.display.set_mode((windowwidth, windowheight))     basicfont = pygame.font.font(none, 18)     pygame.display.set_caption('badger defense - aplha(0.0.1)')      showstartscreen()    #drawing screen displaysurf.fill(bgcolor) pygame.display.update()    #reaction message def checkforkeypress():     events = pygame.event.get()     event in events:             if event.type == pygame.keydown:                 if event.key == pygame.k_space:                     os.system('python game.py')    if __name__ == "__main__":     main() 

i using sublime , running ubuntu 12.04. have game , resources in same folder menu, , have __init__.py file there well.

use pygame.display.update() update screen.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -