import pygame #ovo uvek pisemo da bi pygame #sifra=0 pygame.init() crvena = 0 zelena = 0 plava = 0 width = 500 height = 500 mx=500 my=500 y2 = 10 win = pygame.display.set_mode((width,height)) pygame.display.set_caption("PROGRAMCE") run = True #mx=500 #my=500 #ukupno=0 #uucena=0 #kol=0 #brojac = 0 #mmy=130#povecava y kod stampe racuna #cene = [0,290, 190, 200] #kolicina = [" ", " ", " ", " "] #ukcena = [" ", " ", " ", " "] cene = [290, 190, 200] proizvodi = ["Big Mac", "Coca Cola" , "Pomfrit"] while run: pygame.time.delay(90) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if event.type == pygame.MOUSEBUTTONDOWN: mx,my = pygame.mouse.get_pos(); pygame.draw.rect(win, (255,0,0),(0,0,200,100)) pygame.draw.rect(win, (0,255,0),(0,200,200,100)) pygame.draw.rect(win, (0,0,255),(0,400,200,100)) pygame.draw.rect(win, (crvena,zelena,plava),(200,0,300,500)) #proveravamo za crveno dugme if(mx<=200 and my<=100): crvena = 255 zelena = 0 plava = 0 #proveravamo za zeleno dugme if(mx<200 and my>200 and my<300): crvena = 0 zelena = 255 plava = 0 font = pygame.font.SysFont("Arial", 30) tekstcrvena = font.render("CRVENA", True, pygame.Color("white")) win.blit(tekstcrvena, (40, 35)) tekstzelena = font.render("ZELENA", True, pygame.Color("white")) win.blit(tekstzelena, (40, 235)) dliste = len(proizvodi) for i in range(dliste): tekstp = font.render(proizvodi[i], True, pygame.Color("white")) win.blit(tekstp, (210, y2)) y2 = y2+30 y2=10 #tekst = font.render("RACUN", True, pygame.Color("white")) #win.blit(tekst, (340, 35)) #strukupno = str(ukupno) #tekst = font.render(strukupno, True, pygame.Color("white")) #win.blit(tekst, (360, 110)) #font1 = pygame.font.SysFont("Arial", 20) #tekst = font1.render("1 Big Mac - 290 din.", True, pygame.Color("white")) #win.blit(tekst, (300, 150)) #tekst = font1.render("2 Coca Cola - 190 din.", True, pygame.Color("white")) #win.blit(tekst, (300, 180)) #if(mx<200 and my<100): #sifra = int(input("Unesite sifru proiyvoda")) #kol = int(input("Unesite kolicinu")) #ukupno=ukupno+cene[sifra]*kol #uucena=cene[sifra]*kol #mx = 500 #my = 500 #racun[brojac]=proizvodi[sifra] #kolicina[brojac] = str(kol) #ukcena[brojac]= str(uucena) #brojac=brojac + 1 #for i in range(len(proizvodi)): #tekst = font1.render(racun[i], True, pygame.Color("white")) #win.blit(tekst, (10, mmy)) #tekst = font1.render(kolicina[i], True, pygame.Color("white")) #win.blit(tekst, (120, mmy)) #tekst = font1.render(ukcena[i], True, pygame.Color("white")) #win.blit(tekst, (150, mmy)) #mmy=mmy+30 #if i==len(proizvodi)-1: #mmy=130 pygame.display.update() pygame.quit()