Python 3 Tkinter Script to Track Country By Phone Number Using pycountry Library GUI Desktop App Full Project For Beginners



Welcome folks today in this blog post we will be tracking country by phone number in python using pycountry library and tkinter framework. All the full source code of the application is shown below.





Get Started




In order to get started you need to install the below libraries using the pip command as shown below



pip install pycountry



pip install phone_iso3166



After installing these libraries make an file and copy paste the following code

See also  Python 3 Tkinter Random Color Hexadecimal (RGB) Generator With Preview GUI Desktop App Full Project For Beginners



# install few libraries
# pip install pycountry
# pip install phone-iso3166

# developer- shailendra kumar
# fb-

import json 
import pycountry
from tkinter import Tk, Label, Button, Entry
from import phone_country

class Location_Tracker:
    def __init__(self, App):
        self.window = App
        self.window.title("Phone number Tracker")
        self.window.resizable(False, False)

        #___________Application menu_____________
        Label(App, text="Enter a phone number",fg="white", font=("Times", 20), bg="#3f5efb").place(x=150,y= 30)
        self.phone_number = Entry(App, width=16, font=("Arial", 15), relief="flat")
        self.track_button = Button(App, text="Track Country", bg="#22c1c3", relief="sunken")
        self.country_label = Label(App,fg="white", font=("Times", 20), bg="#3f5efb")

        #___________Place widgets on the window______, y=120), y=200), y=280)

        #__________Linking button with countries ________
        self.track_button.bind("<Button-1>", self.Track_location)
    def Track_location(self,event):
        phone_number = self.phone_number.get()
        country = "Country is Unknown"
        if phone_number:
            tracked = pycountry.countries.get(alpha_2=phone_country(phone_number))
            if tracked:
                    if hasattr(tracked, "official_name"):
                        country = tracked.official_name
                        country =

PhoneTracker = Tk()
MyApp = Location_Tracker(PhoneTracker)


See also  Python 3 WxPython Listbox or Listctrl Widget to Display List of Items in GUI Desktop App Full Project For Beginners



Leave a Reply