![]() You can use padding to align your widgets in this example, label2 has a padding of 100 pixels along the X-axis. Place each label in an appropriate row and column, remember that their indexes begin from zero. You can envision a layout of five rows and two columns. Grid is a geometry manager that organizes widgets in a two-dimensional table. Label2 = Label(root, text= "Corrected Word", fg= 'black', bg= 'violet', font=10) Label1 = Label(root, text= "Input Word", fg= 'black', bg= 'violet', font=10) Headlabel = Label(root, text= 'Spellings Corrector', fg= 'white', bg= "blue", font=10) The constructor accepts a parent window in which you want to place it, the text it should display, the font color, the background color, and the font size. Use Label widgets to display useful information about the application. Set the dimensions of the window to be 900 pixels wide and 450 pixels tall using the geometry() method. ![]() Use the configure() method and set the background color of the window to your desired color such as aqua. Initialize the Tkinter instance and display the root window. Word2_field.insert( 0, corrected_word) Create the User Interface def correction ():Ĭorrected_word = rrection(input_word) Pass this retrieved word to the correction() function, then clear the word2_field widget before using the insert() method to insert the corrected word at the beginning of the field. Use the get() method on the word1_field to get its value as a string. def clearAll ():ĭefine another function named correction() that reads a word from the first input field and adds its correct spelling to the second. To achieve this use the delete() function to remove all entries from 0 to the last index on both entry fields, word1_field and word2_field. ![]() Define a function, clearAll(), that will wipe out the data displayed on the entry field. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |