Skip to content
Related Articles

Related Articles

Improve Article
Create a GUI to Get Domain Information Using Tkinter
  • Last Updated : 29 Dec, 2020

Prerequisites: Python GUI – tkinter

Domain information is very important for every user. It contains information like Name, organization, State, city, Ip address, emails, server name, etc. In this article, we will write code for getting domain information and bind it with GUI Application. We will use the Python-whois module to get information about the website. It’s able to extract data for all the popular TLDs (com, org, net, …)


Before writing the code we need to install python-whois Module. To install this type the below command in the terminal.

pip install python-whois

After installation, let understands this module with examples.

Step 1: Import python-whois module


import whois

Step 2: Use whois.whois( ) methods to get all information.




Step 3: Let’s, extract some importation data from the site.


domain = whois.whois('')
print("Expration Date :",domain.expiration_date)
print("Email :", domain.emails)
print("Server name : ",domain.name_servers)


Expration Date : 2025-06-06 18:16:43
Email :

Let’s create a GUI for the above code using tkinter.



# import modules
from tkinter import *
import whois
# user define funtion
# for get domain information
def Domain_info():
    domain = whois.whois(str(e1.get()))
# object of tkinter
# and background set for red
master = Tk()
# Variable Classes in tkinter
server = StringVar()
exp_date = StringVar()
reg_name = StringVar()
org = StringVar()
state = StringVar()
city = StringVar()
country = StringVar()
# Creating label for each information
# name using widget Label
Label(master, text="Website URL : ", bg="red").grid(row=0, sticky=W)
Label(master, text="Server Name :", bg="red").grid(row=3, sticky=W)
Label(master, text="Expiration date :", bg="red").grid(row=4, sticky=W)
Label(master, text="Regester name :", bg="red").grid(row=5, sticky=W)
Label(master, text="Orgination :", bg="red").grid(row=6, sticky=W)
Label(master, text="State :", bg="red").grid(row=7, sticky=W)
Label(master, text="City :", bg="red").grid(row=8, sticky=W)
Label(master, text="Country :", bg="red").grid(row=9, sticky=W)
# Creating lebel for class variable
# name using widget Entry
Label(master, text="", textvariable=server,
      bg="red").grid(row=3, column=1, sticky=W)
Label(master, text="", textvariable=exp_date,
      bg="red").grid(row=4, column=1, sticky=W)
Label(master, text="", textvariable=reg_name,
      bg="red").grid(row=5, column=1, sticky=W)
Label(master, text="", textvariable=org, bg="red").grid(
    row=6, column=1, sticky=W)
Label(master, text="", textvariable=state,
      bg="red").grid(row=7, column=1, sticky=W)
Label(master, text="", textvariable=city,
      bg="red").grid(row=8, column=1, sticky=W)
Label(master, text="", textvariable=country,
      bg="red").grid(row=9, column=1, sticky=W)
e1 = Entry(master)
e1.grid(row=0, column=1)
# creating a button using the widget
# Button that will call the submit function
b = Button(master, text="Show", command=Domain_info, bg="Blue")
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5,)


 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :