Esempio n. 1
0
def iniciar_sistema():
    while True:
        menu.menu_principal()
        op = input('Digite a opçã0')
        if op == "0":
            print("Saindo do Sistema")
            break
        elif op == "1":
            print("Acessando todas as Câmeras")
def chiff_image(l, h, image_1, image_2, image_f):
    one = []  #list of the first image.
    two = []  #list of the second image.
    list1 = pygame.surfarray.array3d(
        image_1)  # transforms the image into an array.
    list2 = pygame.surfarray.array3d(image_2)
    f1 = [
        [one.append(tuple(b.reshape(-1, 3)[0])) for b in a] for a in list1
    ]  #transforms third dimensional arrays into tuples that added in the lists above.
    f2 = [[two.append(tuple(b.reshape(-1, 3)[0])) for b in a] for a in list2]
    final = [tupl(a, b) for a, b in zip(one, two)
             ]  #applies the last function inside the list of the new image.
    image = numpy.array(final, dtype='uint8').reshape(l, h, 3)
    new_image = pygame.surfarray.make_surface(image)
    disp = pygame.display.set_mode((l, h))
    disp.blit(new_image, (0, 0))

    print("\a")

    import win32api
    rep = win32api.MessageBox(0, "Your image is now done!", "", 0)
    processing = True
    while processing:

        for event in pygame.event.get():
            if event.type == QUIT:
                box = win32api.MessageBox(0, "Are you sure want to leave?", "",
                                          1)
                if box == 1:
                    result = win32api.MessageBox(
                        0, "Do you want to save the picture?", "", 1)
                    if result == 1:
                        pygame.image.save(disp, image_f)
                        processing = False
                        from menu import menu_principal
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ['SDL_VIDEO_CENTERED'] = '1'
                        screen = pygame.display.set_mode((size[0], size[1]),
                                                         pygame.NOFRAME)
                        menu_principal()

                    elif result == 2:
                        processing = False
                        from menu import menu_principal
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ['SDL_VIDEO_CENTERED'] = '1'
                        screen = pygame.display.set_mode((size[0], size[1]),
                                                         pygame.NOFRAME)
                        menu_principal()

        pygame.display.flip()


#[email protected] à contacter en cas ou pour le MP
Esempio n. 3
0
def ajuda(): #função de ajuda do jogo

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
        tela.blit(imagem, (0, 0))
        pygame.display.update()

        #opçõe de volta ao menu principal
        cursor3 = ferramentas2.fer_menu2(tela, ['VOLTAR'], 30, 425, None, 30, 1.4, preto, vermelho)

        if cursor3 == 0: #se a opção escolhida for 0, volta ao menu principal
            menu.menu_principal()

        exit()
Esempio n. 4
0
def iniciar_sistema():
    while True:
        menu.menu_principal()
        opcao = input('Digite a Opcao:')
        if opcao == '0':
            print('Saindo do Sistema')
            break
        elif opcao == '1':
            controladorCliente.iniciar_sistema_cliente()
        elif opcao == '2':
            print('222')
            controladorContrato.iniciar_sistema_contrato()
        elif opcao == '3':
            print('333')
            controladorBoletos.iniciar_sistema_boletos()
        else:
            print('OPCAO INVALIDA - TENTE NOVAMENTE')
def creditos_snake():  #função créditos

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
        tela.blit(imagem, (0, 0))
        pygame.display.update()

        #opçõe de volta ao menu principal
        cursor4 = ferramentas.fer_menu(tela, ['VOLTAR'], 30, 425, None, 30,
                                       1.4, preto, vermelho)

        if cursor4 == 0:  #se a opção escolhida for 0, volta ao menu principal
            menu.menu_principal()

        exit()
Esempio n. 6
0
def iniciar_sistema_cameras():
    while True:
        menu.menu_principal()
        op = input("Digite a opcao")
        if op == "2":
             print("Saindo do Sistema")
             break

        elif op == '1':
            cameraMarca = input("(((((Digite a marca da Câmera:))))")
            cameraIp= input("((((Digite o ip da câmera para rastrear:))))")
            localizar = input("digite o código de acesso:")
            cameras ={
                'cameraMarca' : cameraMarca,
                'cameraIp' : cameraIp,
                'localizar': localizar

            }

            bd.adicionar_camera(cameras)
            print('CAMERA CADRASTRADA COM SUCESSO<<<INICIANDO MONITORAMENTO>>>')
def fim2(): #função para as opções de fim de jogo

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
        tela.blit(imagem, (0, 0))
        pygame.display.update()

        #opçõe de fim de jogo
        cursor3 = ferramentas.fer_menu(tela, ['Jogar Novamente', 'Voltar', 'Sair'], 30, 149, None, 40, 1.2, preto, vermelho)

        if cursor3 == 0: #se a opção escolhida for 0, reinicia o nível 2
            nivel2.rodar2()

        elif cursor3 == 1 : #se a opção escolhida for 1, volta ao menu principal
            menu.menu_principal()

        elif cursor3 == 2: #se a opção escolhida for 2, sai do jogo
            pygame.quit()

        exit()
Esempio n. 8
0
def procedure(l, h, image_a, image_b, image_f, k, op):

    import pygame, numpy, sys
    pygame.init()
    tuple_a = []  #list of the first image.
    tuple_b = []  #list of the second image.
    list1 = pygame.surfarray.array3d(
        image_a)  # transforms the image into an array.
    list2 = pygame.surfarray.array3d(image_b)
    f1 = [
        [tuple_a.append(tuple(b.reshape(-1, 3)[0])) for b in a] for a in list1
    ]  #transforms third dimensional arrays into tuples that added in the lists above.
    f2 = [[tuple_b.append(tuple(b.reshape(-1, 3)[0])) for b in a]
          for a in list2]
    final = [(traitement(op, k, a, b)) for a, b in zip(tuple_a, tuple_b)
             ]  #applies the last function inside the list of the new image.
    image = numpy.array(final, dtype='uint8').reshape(
        l, h, 3)  #convert this list into a 3d image array.
    new_image = pygame.surfarray.make_surface(image)
    screen = pygame.display.set_mode((l, h))
    screen.blit(new_image, (0, 0))

    print("\a")  #bip sound.

    import win32api
    rep = win32api.MessageBox(
        0, "Your image is now done!", "", 0
    )  #message box pop-up (note: requires to download python for windows extensions).

    processing = True
    while processing:
        for event in pygame.event.get():
            if event.type == QUIT:
                import win32api
                box = win32api.MessageBox(0, "Are you sure want to leave?", "",
                                          1)
                if box == 1:
                    result = win32api.MessageBox(
                        0, "Do you want to save the picture?", "", 1)
                    if result == 1:
                        processing = False
                        pygame.image.save(screen, image_f)  #saves the image.
                        from menu import menu_principal  #menu is another program.
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ[
                            'SDL_VIDEO_CENTERED'] = '1'  #centers the display.
                        screen = pygame.display.set_mode(
                            (size[0], size[1]), pygame.NOFRAME
                        )  #pygame.NOFRAME: removes border and controls of the window.
                        menu_principal()

                    elif result == 2:
                        processing = False
                        from menu import menu_principal
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ['SDL_VIDEO_CENTERED'] = '1'
                        screen = pygame.display.set_mode((size[0], size[1]),
                                                         pygame.NOFRAME)
                        menu_principal()

        pygame.display.flip()  #update the screen
Esempio n. 9
0
def Jogar():
    size = width,height = 800, 600
    screen=pygame.display.set_mode(size)
    pygame.display.set_caption('##############  AZUKAY ############### ')
    shurikens=[]
    speed = 4

    dir_direita = False
    dir_esquerda = False
    dir_cima = False
    dir_baixo = False       
    
    player_descendo = pygame.image.load("Sprites/azukay_front/frente.png")
    player_esquerda = pygame.image.load("Sprites/azukay_left/esquerda0.png")
    player_direita = pygame.image.load("Sprites/azukay_right/direita0.png")
    player_subindo = pygame.image.load("Sprites/azukay_back/costas_andando.png")
    statusbar = pygame.image.load("Sprites/bg/statusbar.png")
    shuriken = pygame.image.load("Sprites/shuriken/shuriken.png")
    
    grass = pygame.image.load("Sprites/bg/fundo.png")
    
    
    cima = pyganim.PygAnimation([("Sprites/azukay_back/costas_andando.png",0.1),
                                 ("Sprites/azukay_back/costas_andando1.png",0.1),
                                 ("Sprites/azukay_back/costas_andando2.png",0.1)])
    
    baixo = pyganim.PygAnimation([("Sprites/azukay_front/frente.png",0.1),
                                  ("Sprites/azukay_front/frente_andando1.png",0.1),
                                  ("Sprites/azukay_front/frente_andando2.png",0.1)])
    
    esquerda = pyganim.PygAnimation([("Sprites/azukay_left/esquerda0.png",0.1),
                                     ("Sprites/azukay_left/esquerda1.png",0.1),
                                     ("Sprites/azukay_left/esquerda2.png",0.1),
                                     ("Sprites/azukay_left/esquerda3.png",0.1)])
    
    direita = pyganim.PygAnimation([("Sprites/azukay_right/direita0.png",0.1),
                                    ("Sprites/azukay_right/direita1.png",0.1),
                                    ("Sprites/azukay_right/direita2.png",0.1),
                                    ("Sprites/azukay_right/direita3.png",0.1)])
   
   
    IDLE = pygame.image.load("Sprites/azukay_front/frente.png")
    IDLERect = IDLE.get_rect()
    IDLERect.x = 200
    IDLERect.y = 200
   
    javali = pygame.image.load("Sprites/enemy/javali/lado1.png")
    javaliRect = javali.get_rect()
    javaliRect.x = 700  
    javaliRect.y = 500
    


    
    while 1:
        
        screen.fill(0)
        screen.blit(grass,(0,0))
        screen.blit(statusbar,(0,0))        
        screen.blit(javali,(javaliRect.x,javaliRect.y))     
          


        ##################################################################################################
        #####     movimenta e blita shuriken 
        ##################################################################################################
        
        index=0
        for bullet in shurikens:
            
            velx=math.cos(bullet[0])*8
            vely=math.sin(bullet[0])*8
            bullet[1]+=velx
            bullet[2]+=vely
            if bullet[1]<-0 or bullet[1]>800 or bullet[2]<-0 or bullet[2]>600:
                shurikens.pop(index)
            else:
                index+=1
        for projectile in shurikens:
            shuriken1 = pygame.transform.rotate(shuriken, 360-projectile[0]*57.29)
            screen.blit(shuriken1, (projectile[1], projectile[2]))
            
        ##################################################################################################
        ############ blitando personagem        
        ##################################################################################################
        
        if dir_direita == False and dir_esquerda == False and dir_cima == False and dir_baixo == False:
                    screen.blit(IDLE,(IDLERect.x,IDLERect.y))

        else:
            esquerda.blit(screen, (IDLERect.x,IDLERect.y))   
            cima.blit(screen, (IDLERect.x,IDLERect.y))
            baixo.blit(screen, (IDLERect.x,IDLERect.y))
            direita.blit(screen, (IDLERect.x,IDLERect.y))

        ##################################################################################################
        ##### Captura de eventos      
        ##################################################################################################
        for event in pygame.event.get(): 
                       
            if event.type == QUIT:
                exit()
                
            if event.type == pygame.KEYDOWN:
                if event.key == K_ESCAPE:
                    import menu
                    menu.menu_principal()
                elif event.key== K_w:
                    dir_cima=True                    
                                        
                elif event.key==K_a:
                    dir_esquerda=True                    
                    
                elif event.key==K_s:
                    dir_baixo=True
                    
                elif event.key==K_d:
                    dir_direita=True
                    
        ##################################################################################################            
        ########## shuriken
        ################################################################################################## 

                elif event.key == K_UP and (len(shurikens)< speed):
                    shurikens.append([-1.5707963267948966,IDLERect.centerx,IDLERect.centery])
    
                elif event.key == K_DOWN and (len(shurikens)< speed):
                    shurikens.append([1.5707963267948966,IDLERect.centerx,IDLERect.centery])
    
                elif event.key == K_LEFT and (len(shurikens)< speed):
                    shurikens.append([3.141592653589793,IDLERect.centerx,IDLERect.centery])
    
                elif event.key == K_RIGHT and (len(shurikens)< speed):
                    shurikens.append([0.0,IDLERect.centerx,IDLERect.centery])

        ##################################################################################################
        ############ desativando eventos 
        ##################################################################################################
            if event.type == pygame.KEYUP:
                if event.key ==  K_w:
                    dir_cima =False
                    cima.stop()
                    
                elif event.key==K_a:
                    esquerda.stop()
                    dir_esquerda=False
                    
                elif event.key==K_s:
                    baixo.stop()
                    dir_baixo=False
                    
                elif event.key==K_d:
                    direita.stop()
                    dir_direita=False

        ##################################################################################################
        ###########    pra cima e pra baixo 
        ##################################################################################################
        
        if (dir_cima == True) and (IDLERect.y>70):
            IDLERect.y-= speed
            if dir_baixo==False and dir_esquerda == False and dir_direita == False:
                IDLE = player_subindo
                cima.play()                
            
        elif (dir_baixo == True) and (IDLERect.y<height-100):
            IDLERect.y+=speed
            if dir_cima==False and dir_esquerda == False and dir_direita == False:
                IDLE = player_descendo
                baixo.play()                
            
        ####################### esquerda e direita ####################################################

        if (dir_esquerda == True)  and (IDLERect.x>-20):
            IDLERect.x-=speed
            if dir_cima==False and dir_baixo == False and dir_direita == False:
                IDLE = player_esquerda
                esquerda.play()
            elif dir_direita==False and dir_cima==True:
                IDLE = player_subindo
                esquerda.stop()
                cima.play()
            elif dir_direita==False and dir_baixo==True:
                IDLE = player_descendo
                esquerda.stop()
                baixo.play()
                            
        elif (dir_direita == True) and (IDLERect.x<width-80):
            IDLERect.x+=speed
            if dir_cima==False and dir_baixo == False and dir_esquerda == False:
                IDLE = player_direita
                direita.play()
            elif dir_esquerda==False and dir_cima==True:
                IDLE = player_subindo
                direita.stop()
                cima.play()
            elif dir_esquerda==False and dir_baixo==True:
                IDLE = player_descendo
                direita.stop()
                baixo.play()   
                
        if IDLERect.colliderect(javaliRect):
            x = random.randint(0,1)
            if x == 0:
                javaliRect.x -= 30
            else: 
                javaliRect.y -= 30           
        
        pygame.display.flip()
Esempio n. 10
0
def masquage(l, h, image1, image2, texte):
    one = []
    list1 = pygame.surfarray.array3d(image1)
    f1 = [[one.append(list(b.reshape(-1, 3)[0])) for b in a] for a in list1]
    one = list(
        itertools.chain.from_iterable(one)
    )  #removes hooks or parenthesis of tuples or lists inside the list.

    pre_traitement(l, h, one)

    prepa = list(texte)  #transform string into a list.

    liste = [('%08d' % int(bin(ord(i))[2:])) for i in prepa
             ]  #transforms an integer into a binary of 8-bit length.
    liste = list(itertools.chain.from_iterable(liste))

    while len(liste) < len(
            final
    ):  #in order to have the same length as the image, we append zeros to the text list.
        liste.append('0')

    two = []

    for i, (a, b) in enumerate(
            zip(final, liste)
    ):  #zip(a,b) regroup two objects (here we have two binary with the SAME LENGTH) and examines two elements in the same index.

        if a % 2 == 0 and b == '0':  #case for a pair
            two.append(a)

        if a % 2 == 0 and b == '1':
            two.append(a + 1)

        if a % 2 != 0 and b == '0':  #case for an impair
            two.append((a + 1))

        if a % 2 != 0 and b == '1':
            two.append((a))

    two = [two[i:i + 3] for i in range(0, len(two), 3)
           ]  #[1,2,3,4,5,6,7,8,9] => [[1,2,3], [4,5,6], [7,8,9]]

    image = numpy.array(two, dtype='uint8').reshape(
        l, h, 3)  #convert this list into a 3d image array.
    new_image = pygame.surfarray.make_surface(image)
    disp = pygame.display.set_mode((l, h))
    disp.blit(new_image, (0, 0))

    print("\a")  #bip sound.

    import win32api
    rep = win32api.MessageBox(
        0, "Your image is now done!", "", 0
    )  #message box pop-up (note: requires to download python for windows extensions).
    processing = True
    while processing:

        for event in pygame.event.get():
            if event.type == QUIT:
                box = win32api.MessageBox(0, "Are you sure want to leave?", "",
                                          1)
                if box == 1:
                    result = win32api.MessageBox(
                        0, "Do you want to save the picture?", "", 1)
                    if result == 1:
                        pygame.image.save(disp, image2)  #saves the image.
                        processing = False
                        from menu import menu_principal  #menu is another program.
                        menu = pygame.image.load(
                            'menu.png')  #menu is another program.
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ[
                            'SDL_VIDEO_CENTERED'] = '1'  #centers the display.
                        screen = pygame.display.set_mode(
                            (size[0], size[1]), pygame.NOFRAME
                        )  #pygame.NOFRAME: removes border and controls of the window.
                        menu_principal()

                    elif result == 2:
                        processing = False
                        from menu import menu_principal
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ['SDL_VIDEO_CENTERED'] = '1'
                        screen = pygame.display.set_mode((size[0], size[1]),
                                                         pygame.NOFRAME)
                        menu_principal()

        pygame.display.flip()  #update the screen.
Esempio n. 11
0
def ale_image(l, h, image_f):

    processing = True
    picture = pygame.display.set_mode((l, h))
    pygame.display.iconify()  #reduces the window.
    import win32api

    one = []
    while len(one) < l * h:
        r = random.randint(0, 255)  #red random value.
        g = random.randint(0, 255)  #green.
        b = random.randint(0, 255)  #blue.
        one.append(tuple((r, g, b)))  #creates a new list of tuples RGB.

    image = numpy.array(one, dtype='uint8').reshape(
        l, h, 3)  #convert this list into a 3d image array.
    new_image = pygame.surfarray.make_surface(
        image)  #convert array into surface.
    disp = pygame.display.set_mode((l, h))  #initialize display.
    disp.blit(new_image, (0, 0))  #paste image on the display.

    print("\a")  #bip sound.

    import win32api
    rep = win32api.MessageBox(
        0, "Your image is now done!", "", 0
    )  #message box pop-up (note: requires to download python for windows extensions).
    processing = True
    while processing:

        for event in pygame.event.get():
            if event.type == QUIT:
                box = win32api.MessageBox(0, "Are you sure want to leave?", "",
                                          1)
                if box == 1:
                    result = win32api.MessageBox(
                        0, "Do you want to save the picture?", "", 1)
                    if result == 1:
                        pygame.image.save(disp, image_f)  #saves the image.
                        processing = False
                        from menu import menu_principal  #menu is another program.
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ[
                            'SDL_VIDEO_CENTERED'] = '1'  #centers the display.
                        screen = pygame.display.set_mode(
                            (size[0], size[1]), pygame.NOFRAME
                        )  #pygame.NOFRAME: removes border and controls of the window.
                        menu_principal()

                    elif result == 2:
                        processing = False
                        from menu import menu_principal
                        menu = pygame.image.load('menu.png')
                        size = [(menu.get_width()), (menu.get_height())]
                        os.environ['SDL_VIDEO_CENTERED'] = '1'
                        screen = pygame.display.set_mode((size[0], size[1]),
                                                         pygame.NOFRAME)
                        menu_principal()

        pygame.display.flip()  #update the screen
Esempio n. 12
0
def executar_jogo():
    menu.menu_principal()