12/31/2022 0 Comments Tkinter example python 3 pdf![]() #Return word to root word/chop-off derivational affixes# ![]() #Removes the stop words from the paragraph# Stop_words = set(stopwords.words("english")) #Imports stopwords to be removed from paragraph# #Removes all remaining tokens that are not alphabetic# #Filters out punctuation from paragraph witch becomes tokenized to words and punctuation# #Method that a pdf that is read into the program goes through to eliminate any unwanted words or symbols# ![]() import word_bag_GUIįrom nltk.tokenize import RegexpTokenizerįrom import WordNetLemmatizer To do this, I attempted to use tkinter, because all other GUI are unavailable for me to use, and I can get the window and the buttons necessary to appear, as well as the file explorer to open, however I can't figure out how to actually have the code exectue when I "double-click" the PDF I want the code to read. I want to make my code more stream-lined, so a user can decide what PDF the program will read, regardless of where the PDF actually is. So far, the program has been able to execute this when the PDF that is being read is located in the same file as the program that is being executed. Pretty neat, huh? Obviously there is much more to cover.The program I am writing is able to take in a PDF, find all the non-stop words in the PDF, display all of those words in a table as well as how often they appeared in the PDF, and then display that table in a web browser. The above code put together should spawn you a window that looks like: app = Window(root)įinally, show it and begin the mainloop. Here, that would be the only window, but you can later have windows within windows. The above is really all we need to do to get a window instance started. Then we define the settings upon initialization. Frame is a class from the tkinter module. Here, we are creating our class, Window, and inheriting from the Frame class. Simple enough, just import everything from tkinter. Let's walk through each step to making a tkinter window: ![]() Python is not very popularly used for this purpose, but it is more than capable of doing it. We get a window that we can resize, minimize, maximize, and close! The tkinter module's purpose is to generate GUIs. Here, we show how simple it is to create a very basic window in just 8 lines. The tkinter module is a wrapper around tk, which is a wrapper around tcl, which is what is used to create windows and graphical user interfaces. In this video, we begin discussion of the tkinter module. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |