Sooooo... I've created a very basic menu program. At present, it is merely 3 rectangles, with choice detection.\n\nSo far, it's as basic as can be - but it took me long enough to work out that I thought I would share it. :lol: Hopefully tomorrow I'll make some further progress with it, and actually have it operating as a full functioning menu with text and images and everything.\n\n\n\nThe code is very basic and untidy at present. Tomorrow I plan to re-write the code as OOP and expand the functionality of it. The code below isn't finished, I haven't added in any way of detecting an ENTER key event yet, but that's easy enough. Once it's added, pressing enter will use the choice variable to call the appropriate function (New, Load, Settings etc).\n\nThe overall idea is to write a decent looking menu program, which can then be implemented in larger game projects I intend on making.\n\n\n# Menu Program Rectangles.\n\n\nimport pygame\nimport sys\nfrom pygame.locals import *\npygame.init()\nscreen = pygame.display.set_mode((600,500))\npygame.display.set_caption("Drawing Rectangles")\n\npos_x = 200\npos_y = 175\n\nblack = Color('black')\nwhite = Color('white')\nblue = Color('blue')\n\nchoice = 0\n \n \ndef print_text(font, x, y, text, color=(255,255,255)):\n imgText = font.render(text, True, color)\n screen = pygame.display.get_surface() #req'd when function moved into MyLibrary\n screen.blit(imgText, (x,y))\n\nfont = pygame.font.Font(None, 30)\n\n\n\nwhile True:\n\n for event in pygame.event.get():\n if event.type == QUIT: sys.exit()\n elif event.type == KEYDOWN:\n if event.key == pygame.K_DOWN:\n choice += 1\n if choice > 2: choice = 2\n elif event.key == pygame.K_UP:\n choice -= 1\n if choice < 0: choice = 0\n\n load = "LOAD"\n new = "NEW"\n\n screen.fill((black))\n \n color0 = white\n color1 = white\n color2 = white\n \n selected = ""\n\n keys = pygame.key.get_pressed()\n\n pos1 = pos_x, 150, 200, 50\n pos2 = pos_x, 210, 200, 50\n pos3 = pos_x, 270, 200, 50\n width = 4\n\n if choice == 0:\n color0 = blue\n elif choice == 1:\n color1 = blue\n elif choice == 2:\n color2 = blue\n\n \n pygame.draw.rect(screen,color0, pos1, width)\n pygame.draw.rect(screen,color1, pos2, width)\n pygame.draw.rect(screen,color2, pos3, width)\n\n\n pygame.display.update()\n \n\n\nTomorrow:\n\n\nRe-write program as a class.\nAdd "Enter" functionality for selection.\nAdd text and images.\nTry implementing it in a game.