Open In App
Related Articles

Create a GUI to find the IP for Domain names using Python

Improve Article
Save Article
Like Article

Prerequisite: Python GUI – tkinter

In 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 as a list, and returns a list of associated IP.

Run this code into your terminal for installation.

pip install iplookup


  • Import module
  • Create objects of iplookup
  • Pass the domain into iplookup obj
  • Now traverse the IP



# import module
from iplookup import iplookup
#create object of iplookup
ip = iplookup.iplookup
# Input by geek
# domain name
domain = ""
# pass the domain
# into iplookup obj
result = ip(domain)
# traverse the ip
print("Domain name : ",domain)
print("Ip : ",result)


Domain name :
Ip :  ['']

IP lookup from domain GUI Application with Tkinter: This Script implements the above Implementation into a GUI.


# import modules
from tkinter import *
from tkinter import messagebox
from iplookup import iplookup
def get_ip():
        ip = iplookup.iplookup
        result = ip(e.get())
        messagebox.showerror("showerror", "Something wrong")
# object of tkinter
# and background set for light grey
master = Tk()
master.configure(bg='light grey')
# Variable Classes in tkinter
res = StringVar()
# Creating label for each information
# name using widget Label
Label(master, text="Enter website name :",
      bg="light grey").grid(row=0, sticky=W)
Label(master, text="Result :", bg="light grey").grid(row=1, sticky=W)
# Creating label for class variable
# name using widget Entry
Label(master, text="", textvariable=res, bg="light grey").grid(
    row=1, column=1, sticky=W)
e = Entry(master)
e.grid(row=0, column=1)
# creating a button using the widget
# Button that will call the submit function
b = Button(master, text="Show", command=get_ip)
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 04 Dec, 2021
Like Article
Save Article
Similar Reads
Related Tutorials