i am trying my hardest to make a gui using python and pygame. So far i can only get one screen up and viewable called screen3 in my sript, but when i put screen2 below the code of screen3 it overwrites the first screen. what im after is press a png image (what to be a clickable button) then goes to another screen with other icons on it.
please see by the last coding that works that this is just one screen. how do i add other screens and make the icons turn into clickable buttons (like under the image)
if some one could help me with the code side like an example or unless someone is bored and could write abit of code added on and i can then see the patterns i will need to use.
Code: Select all
#! /usr/bin/env python
import pygame, sys
from pygame.locals import *
pygame.init()
screen3 = pygame.display.set_mode((320,240)) #screen size
white = 255,255,255 #colour of screen
override = pygame.image.load("icons/override.png")# button images
users = pygame.image.load("icons/users.png")
changepin = pygame.image.load("icons/changepin.png")
settings = pygame.image.load("icons/settings.png")
screen3.fill(white)
screen3.blit(override,(5,10))# button position
screen3.blit(users,(165,10))
screen3.blit(changepin,(5,120))
screen3.blit(settings,(165,120))
pygame.display.flip()
while True : #main loop
for event in pygame.event.get() :
if event.type == QUIT :
pygame.quit()
sys.exit()
pygame.display.update()