Today I’m going to share with you how to build a simple desktop application to identify and track country information from phone numbers. It’s a very basic app, therefore you just need to have the basics of Python to be able to complete this tutorial. Requirements phone-iso3166 pycountry Tkinter Please install the above python libraries for you to able to completely follow through this Tutorial Installation pip install python-tk, phone-iso3166 , pycountry We are going to use to determine the get alpha_2 letters of the country from the number and pycountry to determine the official name of the country using alpha_2 letters we obtained from . phone-iso3166 phone-iso3166 Sample code >>> pycountry >>> phone_iso3166.country phone_country >>> code = phone_country( ) >>> code >>> pycountry.countries.get(alpha_2 = code) Country(alpha_2= , alpha_3= , common_name= , name= , numeric= , official_name= ) >>> import from import "255757295721" 'TZ' 'TZ' 'TZA' 'Tanzania' 'Tanzania, United Republic of' '834' 'United Republic of Tanzania' Well now we know how to get country information from a phone number, We need to put our logic code in a form of an App so as we can easily use it. Below is a code of the skeleton for our GUI app with function using the logic we learned above app.py json pycountry tkinter Tk, Label, Button, Entry phone_iso3166.country phone_country = App self.window.title( ) self.window.geometry( ) self.window.configure(bg= ) self.window.resizable(False, False) #___________Application menu_____________ Label(App, text= ,fg= , font=( , ), bg= ).place(x= ,y= ) self.phone_number = Entry(App, width= , font=( , ), relief= ) self.track_button = Button(App, text= , bg= , relief= ) self.country_label = Label(App,fg= , font=( , ), bg= ) #___________Place widgets on the window______ self.phone_number.place(x= , y= ) self.track_button.place(x= , y= ) self.country_label.place(x= , y= ) #__________Linking button countries ________ self.track_button.bind( , self.Track_location) # def Track_location(self,event): phone_number = self.phone_number.get() country = phone_number: tracked = pycountry.countries.get(alpha_2=phone_country(phone_number)) print(tracked) tracked: country = tracked.official_name self.country_label.configure(text=country) PhoneTracker = Tk() MyApp = Location_Tracker(PhoneTracker) PhoneTracker.mainloop() import import from import from import : ( , ): . class Location_Tracker def __init__ self App self window "Phone number Tracker" "500x400" "#3f5efb" "Enter a phone number" "white" "Times" 20 "#3f5efb" 150 30 16 "Arial" 15 "flat" "Track Country" "#22c1c3" "sunken" "white" "Times" 20 "#3f5efb" 170 120 200 200 100 280 with "<Button-1>" 255757294146 "Country is Unknown" if if Output: Once you run the output, it will look like this below. Now you can experiment with different numbers from different locations to determine their country of origin. Congratulations, you just made your own phone location tracker, If you find this post useful, share it with your fellow friends that you have made a cool desktop app. Don’t forget to subscribe to be updated on upcoming Python tutorials. To get the whole code you can check out on my GITHUB PROFILE Previously published at https://kalebujordan.com/how-to-track-phone-number-in-python/