Letra Anterior Letra Seguinte
from tkinter import * from tkinter import messagebox def mostrar_letras (): input_letra = letra.get().strip() if not input_letra: messagebox.showwarning( "Erro" , "Por favor, digite uma letra." ) return if len (input_letra) > 1 : messagebox.showwarning( "Erro" , "Por favor, digite apenas uma letra." ) return if not input_letra.isalpha(): messagebox.showwarning( "Erro" , "Por favor, digite uma letra válida (a-z ou A-Z)." ) return char_code = ord (input_letra.lower()) if 'a' <= chr (char_code) <= 'z' : prev_char_code = char_code - 1 prev_letra = chr (prev_char_code) if prev_char_code >= ord ( 'a' ) else 'N/A' next_char_code = char_code + 1 next_letra = chr (next_char_code) if next_char_code <= ord ( 'z' ) else 'N/A' else : prev_letra = 'N/A' ...