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

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
Approach:
- Import module
- Create objects of iplookup
- Pass the domain into iplookup obj
- Now traverse the IP
Implementation:
Python3
| # import modulefromiplookup importiplookup#create object of iplookupip =iplookup.iplookup# Input by geek# domain namedomain ="zambiatek.com"# pass the domain# into iplookup objresult =ip(domain)# traverse the ipprint("Domain name : ",domain)print("Ip : ",result) | 
Output:
Domain name : zambiatek.com Ip : ['34.218.62.116']
IP lookup from domain GUI Application with Tkinter: This Script implements the above Implementation into a GUI.
Python3
| # import modulesfromtkinter import*fromtkinter importmessageboxfromiplookup importiplookupdefget_ip():    try:        ip =iplookup.iplookup        result =ip(e.get())        res.set(result)    except:        messagebox.showerror("showerror", "Something wrong")# object of tkinter# and background set for light greymaster =Tk()master.configure(bg='light grey')# Variable Classes in tkinterres =StringVar()# Creating label for each information# name using widget LabelLabel(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 EntryLabel(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 functionb =Button(master, text="Show", command=get_ip)b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)mainloop() | 
Output:
 
				 
					



