• Как написать программу в пайгейм, чтобы после нажатия Alt программа не реагировала на эту клавишу?

    @Lookmir Автор вопроса
    import pygame

    from Enigma_Keyboard_EN import Keyboard
    from Enigma_Plugboard_EN import Plugboard
    from Enigma_Reflector_EN import Reflector
    from Enigma_Rotors_EN import Rotor
    from Enigma_EN import Enigma
    from Enigma_Draw_EN import Draw

    pygame.init()
    pygame.font.init()
    pygame.display.set_caption("Enigma_Simulator")

    MONO = pygame.font.SysFont("FreeMono", 25)
    BOLD = pygame.font.SysFont("FreeMono", 25, bold=True)

    WIDTH = 1600
    HEIGHT = 900
    SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))
    MARGINS = {"top": 200, "bottom": 100, "left": 100, "right": 100}
    GAP = 100
    INPUT = ""
    OUTPUT = ""
    PATH = []

    I = Rotor("EKMFLGDQVZNTOWYHXUSPAIBRCJ", "Q")
    II = Rotor("AJDKSIRUXBLHWTMCQGZNPYFVOE", "E")
    III = Rotor("BDFHJLCPRTXVZNYEIWGAKMUSQO", "V")
    IV = Rotor("ESOVPZJAYQUIRHXLNFTGKDCMWB", "J")
    V = Rotor("VZBRGITYUPSDNHLXAWMJQOFECK", "Z")
    A = Reflector("EJMZALYXVBWFCRQUONTSPIKHGD")
    B = Reflector("YRUHQSLDPXNGOKMIEBFZCWVJAT")
    C = Reflector("FVPJIAOYEDRZXWGCTKUQSBNMHL")
    KB = Keyboard()
    PB = Plugboard(["AR", "GK", "OX"])

    ENIGMA = Enigma(B, I, II, III, PB, KB)

    ENIGMA.set_ring((1, 1, 1))
    ENIGMA.set_key("AAA")

    animating = True
    while animating:

    SCREEN.fill("#333333")

    Draw(ENIGMA, PATH, SCREEN, WIDTH, HEIGHT, MARGINS, GAP, BOLD)

    text = BOLD.render(INPUT, True, "white")
    text_box = text.get_rect(center=(WIDTH / 2, MARGINS["top"] / 3))
    SCREEN.blit(text, text_box)

    text = MONO.render(OUTPUT, True, "white")
    text_box = text.get_rect(center=(WIDTH / 2, MARGINS["top"] / 3 + 25))
    SCREEN.blit(text, text_box)

    pygame.display.flip()

    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    animating = False
    elif event.type == pygame.KEYDOWN:
    if event.key == pygame.K_DOWN:
    II.rotate()
    elif event.key == pygame.K_SPACE:
    INPUT = INPUT + " "
    OUTPUT = OUTPUT + " "
    else:
    key = event.unicode
    if key in "abcdefghijklmnopqrstuvwxyz":
    letter = key.upper()
    INPUT = INPUT + letter
    PATH, cipher = ENIGMA.encipher(letter)
    OUTPUT = OUTPUT + cipher