Create a GUI to check Domain Availability using Tkinter
Last Updated :
09 Dec, 2021
There might be a case where a user wants to create a website and having certain ideas for the website's name but is struck on their availability. So let's develop a GUI that will check for domain availability. 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, …)
Installation
Before writing the code we need to install the python-whois Module. To install this type the below command in the terminal.
pip install python-whois
After installation, let write code with examples.
Import the python-whois module and extracting information from the site
Python3
import whois
whois.whois('geeksforgeeks.com')
Output:
If we are getting this type of information then it means this domain is registered for geeksforgeeks.
Now let's write code for check domain availability.
Python3
# importing modules
import whois
import sys
# Use exception handle program
# and get information from whois
try:
domain = whois.whois("geeksforgeeks.com")
if domain.domain_name == None:
sys.exit(1)
except :
print("This domain is available")
else:
print("Oops! this domain already purchased")
Output:
Oops! this domain already purchased by GEEKSFORGEEKS.COM
Let's check this on the domain site.
Checking myeeks.com domain availability.
Python3
domain = whois.whois("myeeks.com")
Output:
This domain is available
Let's check this on the domain site.
Let's create a GUI for the same using Tkinter.
Implementation:
Python3
# import modules
from tkinter import *
import whois
import sys
# user define function
# for get domain information
def Domain_info():
try:
domain = whois.whois(str(e1.get()))
if domain.domain_name == None:
sys.exit(1)
except:
result = "This domain is available"
else:
result = "Oops! this domain already purchased"
res.set(result)
# object of tkinter
# and background set for red
master = Tk()
master.configure(bg='red')
# Variable Classes in tkinter
res = 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="Result :", bg="red").grid(row=3, sticky=W)
# Creating label for class variable
# name using widget Entry
Label(master, text="", textvariable=res, bg="red").grid(
row=3, 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,)
mainloop()
Output:
Similar Reads
Create a GUI to Get Domain Information Using Tkinter 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 us
2 min read
Create First GUI Application using Python-Tkinter We are now stepping into making applications with graphical elements, we will learn how to make cool apps and focus more on its GUI(Graphical User Interface) using Tkinter.What is Tkinter?Tkinter is a Python Package for creating GUI applications. Python has a lot of GUI frameworks, but Tkinter is th
12 min read
Python | ToDo GUI Application using Tkinter Prerequisites : Introduction to tkinter Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. In this article, we will learn how to create a ToDo GUI application using Tkinter, with a step-by-step guide.
5 min read
Create a GUI to find the IP for Domain names using Python Prerequisite: Python GUI â tkinterIn this article, we are going to see how to find IP from Domain Names and bind it with GUI Application using Python. We will use iplookup module for looking up IP from Domain Names. It is a small module which accepts a single domain as a string, or multiple domains
2 min read
Build a GUI Application to ping the host using Python Prerequisite: Python GUI â Tkinter In this article, we are going to see how to ping the host with a URL or IP using the python ping module in Python. This module provides a simple way to ping in python. And It checks the host is available or not and measures how long the response takes. âBeforeâ sta
2 min read