Organize it by adding a padding of 20 in the vertical direction.ĭefine a frame to organize your buttons. Set the parent window you want to place it in, the font style, the width, and the background color. My_nfig(command=my_list.yview)ĭefine an entry widget to accept tasks as input from the user. So, when the user interacts with the scrollbar, the listbox views change accordingly. On setting the command parameter as my_list.yview, the scrollbar's movement gets linked to the up and down functions. On setting the value of the yscrollcommand as my_t it gets the current position of the scrollbar on user interaction. Use the config() method to bind the scrollbar to the listbox widget you defined earlier. My_list = Listbox(my_frame, font=my_font, width= 40, height= 7, bg= "#cf9fff", bd= 0, fg= "#5c4033", highlightthickness= 0, selectbackground= "#ff0000", activestyle= "none")ĭefine a scrollbar that the program will display on the right side of the frame, filling any extra space in both directions. my_font = Font(family= "Arial", size= 22, weight= "bold") Organize the list by placing it on the left side and telling it to fill any extra space in both directions. Also, set the focus highlight's thickness, the background color it should have when selected, and the appearance of the active line as None. Set the parent window you want to place it in, the font style, the width, the height, the background color, the border width, and the font color. This component displays a list of items for the user to select. Set the parent window you want to place it in and give it a vertical padding of 10.ĭefine a listbox widget. A frame acts as a container and is responsible for arranging the position of other widgets. from tkinter import *ĭefine a font style and a frame widget. Also set the title and the size of the window. Using the configure() function, set the background color. Import the Tkinter module and initialize the root window. You can find the source code of the To-Do Application in this GitHub repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |