Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

GUI python

I can't get an entry and apply a fucnction to it using a button.

here is the code, it is a spell checking program that takes a text and shows what are the spelling mistakes in it:

from tkinter import *
from tkinter import messagebox
import nltk
from nltk.corpus import words
def spellchecker(s):
    x=words.words()
    z=s.split()
    for i in z:    
        if i.lower() in x:
            pass
        else:
            print("{} is not in dic.".format(i))
top = Tk()
top.geometry('800x800')
top.title("Hello Window")
b=Button(text="Hello", command=spellchecker, bg="red", fg="white")
b.place(x=400,y=600)
E=Entry(top)
E.place(x=10,y=100)
top.mainloop()


0 Answer
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.