• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

Write an application to investigate the phone number of the country with Python

AnonyViet by AnonyViet
April 22, 2025
in Tips
0

Today, I will show you how to create application application application applications to see it in the country with Python. The way to do it is quite simple because we already have libraries. This article is quite basic because it is for beginners to understand Python. If you want to study after Python, please comment below, Anonyviet will make more advanced exercises.

Join the channel Telegram belong to Anonyviet 👉 Link 👈

Write an application to look up the phone number of the country with Python 6

This is a very simple phone number checking application, so you only need to have a basic knowledge about Python to be able to complete this application.

How to create applications for phone number

Request

You need to install the Python libraries above to use in this application.

Setting

pip install python-tk, phone-iso3166, pycountry

I will use Phone-ISO3166 to determine the nation's abbreviation and assign variable alpha_2 and pycountry To determine the full name of that country by using alpha_2 that we have collected from phone-iso3166.

Sample code

>>> import pycountry
>>> from phone_iso3166.country import phone_country
>>> code = phone_country("255757295721")
>>> code
'TZ'
>>> pycountry.countries.get(alpha_2 = code)
Country(alpha_2='TZ', alpha_3='TZA', common_name="Tanzania", name="Tanzania, United Republic of", numeric="834", official_name="United Republic of Tanzania")
>>> 

Now we know how to get national information from the phone number, but this application still works in the form of Command Line. So now, we will design the GUI for the application.

Create app.py file

Open Notepad to create App.Py file with the content below

import json 
import pycountry
from tkinter import Tk, Label, Button, Entry
from phone_iso3166.country import phone_country


class Location_Tracker:
    def __init__(self, App):
        self.window = App
        self.window.title("Phone number Tracker")
        self.window.geometry("500x400")
        self.window.configure(bg="#3f5efb")
        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______
        self.phone_number.place(x=170, y=120)
        self.track_button.place(x=200, y=200)
        self.country_label.place(x=100, y=280)

        #__________Linking button with countries ________
        self.track_button.bind("", self.Track_location)
        #255757294146
    
    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))
            print(tracked)
            if tracked:
                country = tracked.official_name
        self.country_label.configure(text=country)



PhoneTracker = Tk()
MyApp = Location_Tracker(PhoneTracker)
PhoneTracker.mainloop()

To run the newly created file on Windows, open CMD and type the command python app.py To launch the program

Result

When you enter the phone number, note the first 0 instead 84 okay, for example: 84304xxxxxx. After entering, click Enter Click Enter to know which country the phone number from.

Which country is the phone number?

Done, you have just created the application of the phone number position according to your own country already. If you find this application interesting, please share it with your friends. You can also see more ways Hide the message in the photo Anonyviet introduced.

Previous Post

Top 5 shops selling home appliances on shopee: cheap, reputable, quality

Next Post

Accelerate programming with Blackbox Ai: Have you tried it yet?

AnonyViet

AnonyViet

Related Posts

How to detect IRQ conflict – Hardware conflict on Windows
Tips

How to detect IRQ conflict – Hardware conflict on Windows

May 13, 2025
How to use Auto Share Facebook to increase the article sharing
Tips

How to use Auto Share Facebook to increase the article sharing

May 12, 2025
Instructions for installing Facebook Lite on super light iPhone
Tips

Instructions for installing Facebook Lite on super light iPhone

May 10, 2025
Download Vietnamese Pascal Video course for beginners
Tips

Download Vietnamese Pascal Video course for beginners

May 9, 2025
How to download and delete your information on Google
Tips

How to download and delete your information on Google

May 8, 2025
How does the police ask Facebook to provide criminal data?
Tips

How does the police ask Facebook to provide criminal data?

May 7, 2025
Next Post
Accelerate programming with Blackbox Ai: Have you tried it yet?

Accelerate programming with Blackbox Ai: Have you tried it yet?

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Lucida: Download SoundCloud, Tidal for free, no advertising

Lucida: Download SoundCloud, Tidal for free, no advertising

May 13, 2025
How to detect IRQ conflict – Hardware conflict on Windows

How to detect IRQ conflict – Hardware conflict on Windows

May 13, 2025
Learn about En81 safety standards for home elevators

Learn about En81 safety standards for home elevators

May 12, 2025
Change super easy Windows folder icon

Change super easy Windows folder icon

May 12, 2025
Lucida: Download SoundCloud, Tidal for free, no advertising

Lucida: Download SoundCloud, Tidal for free, no advertising

May 13, 2025
How to detect IRQ conflict – Hardware conflict on Windows

How to detect IRQ conflict – Hardware conflict on Windows

May 13, 2025
Learn about En81 safety standards for home elevators

Learn about En81 safety standards for home elevators

May 12, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Lucida: Download SoundCloud, Tidal for free, no advertising

Lucida: Download SoundCloud, Tidal for free, no advertising

May 13, 2025
How to detect IRQ conflict – Hardware conflict on Windows

How to detect IRQ conflict – Hardware conflict on Windows

May 13, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí SHBET bongdaso

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí SHBET bongdaso