![]() Addcontact() function used to add new contact.Selected() function used to return selected value.Here Scrollbar widget and Listbox widget is used to allow users to select from many optionsĬontactlist.append()Ĭontactlist =.Frame is like a container that is used to organized widgets.Contacts’ information is stored in contactlist.bg use to set the background color of the window.resizable(0,0) this command stop window to resize.geometry() sets the window width and height.Select.pack(side=LEFT, fill=BOTH, expand=1) Select = Listbox(frame, yscrollcommand=t, height=12) Scroll = Scrollbar(frame, orient=VERTICAL) ![]() ![]() Here, we need to import tkinter module 2. These are the step to build a contact book python project: Please download the source code of address book project: Address book source code Project File Structure To install the library we use the pip install command in the command prompt: pip install tkinter Tkinter is a standard GUI library for rendering graphics We build the address book project with the help of Tkinter module and basic python concept. To add a new contact user has to click on the add button. In this python project for beginners, the user has to click on a button which functions the user wants to access eg – To edit a contact, the user has to first select a contact then click on view button then edit the contact and then click on edit button. The objective of this project is to create an Address book using python in which the user can add a new contact, edit and delete existing contact and view all the contact. You can also edit and delete the contact. To run the program, enter the following command in a Terminal/Command LineĮ-mail Address: Contact created successfully.Free Python course with 35 real-time projects Start Now!!Ī contact book or address book is an application that stores the information (name, address, contact no, etc.) of people that you save in it. The code is big because of the different operations we can perform but it is quite simple and intuitive. We have created a menu with 6 options and we have methods in our class to perform each of these operations (except exit). #- Search Contact -# def search (self, number=False, name=False): if name:Ĭhoice = int(input( '\nEnter your Choice: ' )) Print( '\nTotal Contacts found: ', len(self.book)) Print( '\nNumber Entries: ', self.numbers)Ĭ, 'number: ', self.numbers, 'details: ', self.book, '\n' ) 'Are you sure want to DELETE.? (y/n): ' ).lower() Input( 'Enter index of listed CONTACT above: ' )) #- DELETE Contacts -# def delete (self, name=False, number=False): if name:Ĭ, 'name: ', self.names, 'details: ', self.book, '\n' ) Inp = input( "Press 'y' to continue or exit to 'n': " ) ![]() Print( 'No.of contacts found: ', len(inumbers))Ĭ, 'Number: ', self.numbers, 'details: ', self.book, '\n' ) Print( 3, '- Email: ', self.book)Ĭh_name = input( 'Enter name to update: ' )Ĭh_email = input( 'Enter Email to update: ' ) Input( 'Enter index of listed contact above: ' )) "Press 'y' to continue or exit to 'n': " ).lower() Print( 'No.of contacts found: ', len(inames), inames) Print(name, 'Contact created successfully.!' )ĭef update (self, name=False, number=False): # - Update Using Names -# if name: Save the below code in a file named 'contact.py'. Our class will contain different methods for different processes we will use.Īt the end we will create a Command Line Interface for different operations to perform in the contact book. We will use two lists so that we can search by name and phone number both. For this we will create a class containing our contacts as lists. In this article, we will make a contact book.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |