Reputation: 1
from spellchecker import SpellChecker
spell = SpellChecker()
user_words = ""
check_spelling = spell.unknown(user_words)
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
user_text = ""
if spell.correction(f"{check_spelling}") == None:
user_text =""
elif spell.correction(f"{check_spelling}") != None:
user_text = "That's not a word, try again."
pygame.draw.rect(screen, 'lightskyblue3', input_rect)
screen.blit(text_Surface, (input_rect.x+5, input_rect.y+5))
input_rect.w = max(100, text_Surface.get_width()+10)
pygame.display.flip()
pygame.display.update()
clock.tick(60) # limits FPS to 60
I tried having the user text change back to normal if they put in a word, and if they put in a random letter or not a word it should say "That's not a word, try again".
Upvotes: 0
Views: 38