{"id":41,"date":"2022-05-12T04:56:53","date_gmt":"2022-05-12T04:56:53","guid":{"rendered":"http:\/\/www.programminginpython.com\/2023\/03\/30\/how-to-create-a-domain-to-ip-converter-in-python-gui-using-tkinter\/"},"modified":"2023-05-08T18:39:47","modified_gmt":"2023-05-08T18:39:47","slug":"how-to-create-domain-to-ip-converter-python-gui-tkinter","status":"publish","type":"post","link":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/","title":{"rendered":"How to create a Domain to IP converter in Python GUI using TKInter"},"content":{"rendered":"<p>Hello everyone! Welcome back to <a href=\"http:\/\/programminginpython.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">programminginpython.com<\/a>. Here in this post, I will show\u00a0you how to create a simple\u00a0domain to IP converter app in python GUI using TKInter. This app basically converts a domain name like <code>www.google.com<\/code> to its IP address like <code>127.0.0.1<\/code>.<\/p>\n<p>Here I use Python <code>sockets<\/code>to achieve this domain name to IP conversion, I will use one of the methods available in the <code>sockets<\/code> module `gethostbyname()` and the method will return the IP address of it. That is simple, now let us design the GUI for this app, Python GUI is the main discussed topic here, these converter apps are just some examples of it, previously I also discussed <a href=\"http:\/\/programminginpython.com\/create-temperature-converter-app-python-gui-using-tkinter\/\" target=\"_blank\" rel=\"noopener noreferrer\">temperature converter app<\/a> and\u00a0now on domain to IP converter app.<\/p>\n<div class=\"yrc-shell-cover yrc-single\" data-yrc-uid=\"69e0394d0f902\" data-yrc-channel=\"{&quot;meta&quot;:{&quot;user&quot;:&quot;Programming In Python&quot;,&quot;channel&quot;:&quot;UCLBlXUMLYLxopRljNdLXOeQ&quot;,&quot;key&quot;:&quot;yrc_1683138754&quot;,&quot;apikey&quot;:&quot;AIzaSyC3vU6rFyzsO0shrRsAWmjuSiuWYTQhafc&quot;,&quot;cache&quot;:&quot;1440&quot;,&quot;channel_uploads&quot;:&quot;UULBlXUMLYLxopRljNdLXOeQ&quot;,&quot;onlyonce&quot;:&quot;&quot;,&quot;tag&quot;:&quot;&quot;,&quot;per_page&quot;:&quot;24&quot;,&quot;maxv&quot;:&quot;0&quot;,&quot;consent&quot;:{&quot;ask&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;},&quot;ads&quot;:&quot;1&quot;,&quot;uid&quot;:&quot;69e0394d0f902&quot;,&quot;nocookie&quot;:&quot;&quot;,&quot;single&quot;:true},&quot;style&quot;:{&quot;colors&quot;:{&quot;item&quot;:{&quot;background&quot;:&quot;inherit&quot;},&quot;button&quot;:{&quot;background&quot;:&quot;#333&quot;,&quot;color&quot;:&quot;#fff&quot;},&quot;color&quot;:{&quot;text&quot;:&quot;#fff&quot;,&quot;link&quot;:&quot;inherit&quot;,&quot;menu&quot;:&quot;#000&quot;,&quot;meta&quot;:&quot;inherit&quot;}},&quot;theme&quot;:{&quot;videos&quot;:{&quot;style&quot;:&quot;__grid&quot;,&quot;thumb&quot;:[&quot;large&quot;,&quot;open&quot;],&quot;desc&quot;:&quot;&quot;,&quot;carousel&quot;:{&quot;thumbs&quot;:&quot;4&quot;,&quot;thumbs_to_slide&quot;:&quot;2&quot;,&quot;spacing&quot;:&quot;10&quot;},&quot;carousel_nav&quot;:{&quot;modifier&quot;:&quot;__sides&quot;,&quot;position&quot;:&quot;left-none&quot;,&quot;location&quot;:&quot;prepend&quot;,&quot;background&quot;:&quot;#fff&quot;,&quot;color&quot;:&quot;#000&quot;,&quot;font_size&quot;:&quot;2&quot;,&quot;border_radius&quot;:&quot;0&quot;}},&quot;a&quot;:&quot;1&quot;},&quot;fit&quot;:&quot;false&quot;,&quot;playlists&quot;:&quot;true&quot;,&quot;uploads&quot;:&quot;true&quot;,&quot;player_mode&quot;:&quot;1&quot;,&quot;truncate&quot;:&quot;&quot;,&quot;banner&quot;:&quot;true&quot;,&quot;thumb_margin&quot;:&quot;8&quot;,&quot;play_icon&quot;:&quot;hover&quot;,&quot;youtube_play_icon&quot;:&quot;&quot;,&quot;thumb_image_size&quot;:&quot;medium&quot;,&quot;default_tab&quot;:&quot;uploads&quot;,&quot;sticky&quot;:{&quot;enable&quot;:&quot;&quot;,&quot;width&quot;:&quot;400&quot;,&quot;position&quot;:&quot;bottom-right&quot;,&quot;only_above&quot;:&quot;768&quot;,&quot;margin&quot;:&quot;12&quot;},&quot;player&quot;:{&quot;show_desc&quot;:&quot;&quot;,&quot;show_meta&quot;:&quot;&quot;},&quot;menu&quot;:&quot;1&quot;,&quot;rating_style&quot;:&quot;NaN&quot;,&quot;rtl&quot;:false}}\" data-yrc-setup=\"\"><\/div>\r\n\t\t\t<script data-cfasync=\"false\" type=\"text\/javascript\">\r\n\t\t\t\tif( !window.YRC ) var YRC = {Data:{}};\r\n\t\t\t\tYRC.Data[\"69e0394d0f902\"] = {\"video\":\"RgHZkewejS4\"};\r\n\t\t\t\t(function(){\r\n\t\t\t\t\tif(!YRC.loaded){\r\n\t\t\t\t\t    YRC.loaded = true;\r\n\t\t\t\t\t\tfunction YRC_Loader(){\r\n\t\t\t\t\t\t\t\/\/YRC.loaded = true;\r\n\t\t\t\t\t\t\tYRC.is_pro = false;\r\n\t\t\t\t\t\t\tYRC.is_pb = false;\r\n\t\t\t\t\t\t\tYRC.lang = {\"form\":{\"Videos\":\"Videos\",\"Playlists\":\"Playlists\",\"Search\":\"Search\",\"Loading\":\"Loading\",\"more\":\"more\",\"Nothing_found\":\"Nothing found\",\"Prev\":\"Previous\",\"Next\":\"Next\",\"consent_statement\":\"Allow cookies?\",\"consent_button\":\"Allow\",\"consent_privacy_policy\":\"Privacy policy\"},\"fui\":{\"sort_by\":\"Sort by\",\"relevant\":\"Relevant\",\"latest\":\"Latest\",\"liked\":\"Liked\",\"title\":\"Title\",\"views\":\"Views\",\"duration\":\"Duration\",\"any\":\"Any\",\"_short\":\"Short\",\"medium\":\"Medium\",\"_long\":\"Long\",\"uploaded\":\"Uploaded\",\"all_time\":\"All time\",\"live_now\":\"Live Now\",\"today\":\"Today\",\"ago\":\"ago\",\"last\":\"Last\",\"day\":\"day\",\"days\":\"days\",\"week\":\"week\",\"weeks\":\"weeks\",\"month\":\"month\",\"months\":\"months\",\"year\":\"year\",\"years\":\"years\",\"older\":\"Older\",\"show_more\":\"Show More\",\"show_less\":\"Show Less\",\"reply\":\"REPLY\",\"view_replies\":\"View replies\",\"write_comment\":\"Write comment...\",\"billion\":\"B\",\"million\":\"M\",\"thousand\":\"K\",\"max_plain_number\":1000,\"wplocale\":\"en_US\"}};\r\n\t\t\t\t\t\t\tYRC.is_admin = false;\r\n\t\t\t\t\t\t\tvar script = document.createElement(\"script\");\r\n\t\t\t\t\t\t\t\tscript.setAttribute(\"data-cfasync\", \"false\");\r\n\t\t\t\t\t\t\t\tscript.setAttribute(\"type\", \"text\/javascript\");\r\n\t\t\t\t\t\t\t\tscript.src = \"https:\/\/www.programminginpython.com\/wp-content\/plugins\/yourchannel\/js\/yrc.js?1.2.9\";\r\n\t\t\t\t\t\t\t\tscript.id = \"yrc-script\";\r\n\t\t\t\t\t\t\t\tdocument.querySelector(\"head\").appendChild(script);\r\n\t\t\t\t\t\t\tvar style = document.createElement(\"link\");\r\n\t\t\t\t\t\t\t\tstyle.rel = \"stylesheet\";\r\n\t\t\t\t\t\t\t\tstyle.href = \"https:\/\/www.programminginpython.com\/wp-content\/plugins\/yourchannel\/css\/style.css?1.2.9\";\r\n\t\t\t\t\t\t\t\tstyle.type = \"text\/css\";\r\n\t\t\t\t\t\t\t\tdocument.querySelector(\"head\").appendChild(style);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(window.jQuery){YRC_Loader();}else { var yrctimer2324 = window.setInterval(function(){\r\n\t\t\t\t\t\t\tif(window.jQuery){YRC_Loader(); window.clearInterval(yrctimer2324); }\r\n\t\t\t\t\t\t}, 250);}\r\n\t\t\t\t\t} else {if(YRC.EM)YRC.EM.trigger(\"yrc.newchannel\");}\r\n\t\t\t\t}());<\/script>\n<p style=\"text-align: center;\"><strong>You can also watch the video on YouTube <\/strong><a href=\"https:\/\/youtu.be\/RgHZkewejS4\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>here<\/strong><\/a><\/p>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/domain_to_ip.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on Github<\/a><\/span><\/p>\n<h4 class=\"post_h4\">Domain to IP \u2013 TKInter\u00a0GUI Design<\/h4>\n<p>Here I used some widgets like\u00a0<code>Label<\/code>,\u00a0<code>Button<\/code>,\u00a0<code>EntryField<\/code>\u00a0(Input field).<\/p>\n<p>These widgets are used as follows. An\u00a0<code>EntryField<\/code>\u00a0where one can enter any valid domain name like <code>www.example.com<\/code>.\u00a0 A\u00a0<code>Button<\/code>\u00a0when pressed calls the function to find the entered domain name\u2019s IP address. A Label to show the result.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_954\" class=\"wp-caption alignnone\" style=\"width: 673px;\" aria-describedby=\"caption-attachment-954\"><img decoding=\"async\" class=\"wp-image-954 size-full lazyload\" data-src=\"http:\/\/programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_IP.png\" data-sizes=\"(max-width: 673px) 100vw, 673px\" data-srcset=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_IP.png 673w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_IP-300x130.png 300w\" alt=\"Domain to IP converter - programminginpython.com\" width=\"673\" height=\"292\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 673px; --smush-placeholder-aspect-ratio: 673\/292;\" \/><figcaption id=\"caption-attachment-954\" class=\"wp-caption-text\">Domain to IP converter \u2013 programminginpython.com<\/figcaption><\/figure>\n<p>First I must import and initialize TKInter to use it.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import tkinter as tk\r\n\r\nroot = tk.Tk()<\/pre>\n<p>Then I will initialize a\u00a0<code>Label<\/code>\u00a0and an\u00a0<code>EntryField<\/code>\u00a0and also set their position using\u00a0<code>grid<\/code>layout options.<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">input_label = tk.Label(root, text=\"Enter domain\", background='#009688', foreground=\"#FFFFFF\")\r\ninput_entry = tk.Entry(root, textvariable=domainInput)\r\ninput_label.grid(row=1)\r\ninput_entry.grid(row=1, column=1)<\/pre>\n<\/div>\n<p>Here I need to set \u2018domainInput\u2019 to input_entry so I can use that value entered in that\u00a0 field.<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">domainInput = tk.StringVar()<\/code><\/p>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/domain_to_ip.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on Github<\/a><\/span><\/p>\n<h4>The Domain\u00a0to IP converter<\/h4>\n<p>So when a user inputs some value i.e a valid domain name, the next thing is to press a button which shows the desired results.<\/p>\n<p>I initialize a button with a command to call the conversion function.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">result_button = tk.Button(root, text=\"Convert\", command=call_convert, background='#FFFFFF', foreground=\"#009688\")\r\n\r\nresult_button.grid(row=2, columnspan=4)<\/pre>\n<p>I need to pass a label\u00a0to show the result and the input value which is entered in the\u00a0<code>Entry<\/code>\u00a0. Here I use\u00a0<code>partial<\/code>\u00a0from\u00a0<code>functools<\/code>\u00a0to pass parameters to the function\u00a0<code>call_convert<\/code><\/p>\n<p>So before I call\u00a0<code>call_convert<\/code> I will place the following line.<code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">call_convert = partial(call_convert, result_label1, domainInput)<\/code><\/p>\n<p>as you see above I used partial method there, so I need to import\u00a0<code>partial<\/code>.<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"language-default code-embed-pre line-numbers\" data-start=\"1\" data-line-offset=\"0\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">from functools import partial<\/code><\/pre>\n<\/div>\n<p>So now in the function <code>call_convert<\/code>, I use python sockets, which is used to connect to the internet and all other networking stuff.<br \/>\nThere is a method called `gethostbyname()` which takes the input parameter as a domain name and returns its corresponding IP address.<\/p>\n<p>The <code>call_convert<\/code> has 2 parameters, a label for showing the result and other is the input domain.<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"language-default code-embed-pre line-numbers\" data-start=\"1\" data-line-offset=\"0\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">def call_convert(rlabel1, inputn):<\/code><\/pre>\n<\/div>\n<p>so I can now call the\u00a0`gethostbyname()` like,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">import socket\r\n\r\n...\r\n...\r\n\r\n\r\nip = (socket.gethostbyname(inputn.get()))<\/pre>\n<p>Now I will show this result as text on the label.<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"language-default code-embed-pre line-numbers\" data-start=\"1\" data-line-offset=\"0\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">rlabel1.config(text=\"The IP address of domain \" + inputn.get() + \" is \" + ip)<\/code><\/pre>\n<\/div>\n<p>call_convert function:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># the main conversion\r\n\r\n\r\ndef call_convert(rlabel1, inputn):\r\n    try:\r\n        ip = (socket.gethostbyname(inputn.get()))\r\n        rlabel1.config(text=\"The IP address of domain \" + inputn.get() + \" is \" + ip)\r\n    except Exception:\r\n        rlabel1.config(text=\"Please enter a valid url in the form 'www.example.com'\")\r\n    return<\/pre>\n<p>That\u2019s it, IP address of a domain can be found in this simple way.<\/p>\n<p>Now I will tweak the UI a bit, centering window, the elements in it and all such stuff.<\/p>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/domain_to_ip.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on Github<\/a><\/span><\/p>\n<h4 class=\"post_h4\">Domain to IP \u2013 Centering window and elements in it<\/h4>\n<h5>Centering main app window<\/h5>\n<p>As you see in the above image, all the items are centered and also the window also shows at the center of the screen. It is not the default behavior of Python TKInter GUI, I need to set this up.<\/p>\n<p>First, to center the main app window, I use some functions called <code>winfo_reqwidth()<\/code> and <code>winfo_reqheight()<\/code>which returns the natural width and natural height of the widget respectively.\u00a0\u00a0The natural size is the minimal size needed to display the widget\u2019s contents, including padding, borders, etc.<\/p>\n<p>Next, I use 2 other functions like <code>winfo_screenwidth()<\/code> and <code>winfo_screenheight()<\/code>which gets the\u00a0width and height of this widget\u2019s screen respectively, in pixels.<\/p>\n<p>Now I can set the position right and position down so all the elements are centered in the window.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">positionRight = int(root.winfo_screenwidth() \/ 2 - windowWidth \/ 2)\r\n\r\npositionDown = int(root.winfo_screenheight() \/ 2 - windowHeight \/ 2)<\/pre>\n<p>Now I can set the root geometry like,<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"language-default code-embed-pre line-numbers\" data-start=\"1\" data-line-offset=\"0\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">root.geometry(\"600x200+{}+{}\".format(positionRight, positionDown))<\/code><\/pre>\n<\/div>\n<p>So the main app window is centered now.<\/p>\n<h5>Centering elements in the window<\/h5>\n<p>For centering elements in the window, I just place weights on rows and columns to the grid layout.<\/p>\n<div class=\"code-embed-wrapper\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">root.rowconfigure(0, weight=1)\r\nroot.columnconfigure(0, weight=1)\r\nroot.rowconfigure(2, weight=1)\r\nroot.columnconfigure(2, weight=1)\r\n\r\ncontents = tk.Frame(root)\r\ncontents.grid(row=1, column=1)<\/pre>\n<\/div>\n<p>The above 6 lines perfectly align any item to the center of the window.\u00a0This results in a simple centering effect as the columns and rows either side of the main content are expanding equally to fill the window.<\/p>\n<h4 class=\"post_h4\">Program<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">__author__ = 'Avinash'\r\n\r\nimport tkinter as tk\r\nimport socket\r\nfrom functools import partial\r\n\r\n\r\n# the main conversion\r\ndef call_convert(rlabel1, inputn):\r\n    try:\r\n        ip = (socket.gethostbyname(inputn.get()))\r\n        rlabel1.config(text=\"The IP address of domain \" + inputn.get() + \" is \" + ip)\r\n    except Exception:\r\n        rlabel1.config(text=\"Please enter a valid url and in the form 'www.example.com'\")\r\n    return\r\n\r\n# app window configuration and UI\r\nroot = tk.Tk()\r\n\r\n# Gets the requested values of the height and width.\r\nwindowWidth = root.winfo_reqwidth()\r\nwindowHeight = root.winfo_reqheight()\r\n\r\n# Gets both half the screen width\/height and window width\/height\r\npositionRight = int(root.winfo_screenwidth() \/ 2 - windowWidth \/ 2)\r\npositionDown = int(root.winfo_screenheight() \/ 2 - windowHeight \/ 2)\r\n\r\nroot.geometry(\"600x200+{}+{}\".format(positionRight, positionDown))\r\nroot.title('Domain to IP Converter')\r\nroot.configure(background='#009688')\r\nroot.resizable(width=False, height=False)\r\nroot.rowconfigure(0, weight=1)\r\nroot.columnconfigure(0, weight=1)\r\nroot.rowconfigure(2, weight=1)\r\nroot.columnconfigure(2, weight=1)\r\n\r\ncontents = tk.Frame(root)\r\ncontents.grid(row=1, column=1)\r\n\r\ndomainInput = tk.StringVar()\r\n\r\n# label and entry field\r\ninput_label = tk.Label(root, text=\"Enter domain\", background='#009688', foreground=\"#FFFFFF\")\r\ninput_entry = tk.Entry(root, textvariable=domainInput)\r\ninput_label.grid(row=1)\r\ninput_entry.grid(row=1, column=1)\r\n\r\n# result label's for showing the IP of a domain\r\nresult_label1 = tk.Label(root, background='#009688', foreground=\"#FFFFFF\")\r\nresult_label1.grid(row=3, columnspan=4)\r\n\r\n# button click\r\ncall_convert = partial(call_convert, result_label1, domainInput)\r\nresult_button = tk.Button(root, text=\"Convert\", command=call_convert, background='#FFFFFF', foreground=\"#009688\")\r\nresult_button.grid(row=2, columnspan=4)\r\n\r\nroot.mainloop()\r\n<\/pre>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/domain_to_ip.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on Github<\/a><\/span><\/p>\n<h4>Output<\/h4>\n<figure id=\"attachment_962\" class=\"wp-caption alignnone\" style=\"width: 761px;\" aria-describedby=\"caption-attachment-962\"><img decoding=\"async\" class=\"wp-image-962 size-full lazyload\" data-src=\"http:\/\/programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip_2.png\" data-sizes=\"(max-width: 761px) 100vw, 761px\" data-srcset=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip_2.png 761w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip_2-300x132.png 300w\" alt=\"Domain to IP converter - programminginpython.com\" width=\"761\" height=\"335\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 761px; --smush-placeholder-aspect-ratio: 761\/335;\" \/><figcaption id=\"caption-attachment-962\" class=\"wp-caption-text\">Domain to IP converter \u2013 programminginpython.com<\/figcaption><\/figure>\n<figure id=\"attachment_966\" class=\"wp-caption alignnone\" style=\"width: 818px;\" aria-describedby=\"caption-attachment-966\"><img decoding=\"async\" class=\"wp-image-966 size-full lazyload\" data-src=\"http:\/\/programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip3.png\" data-sizes=\"(max-width: 818px) 100vw, 818px\" data-srcset=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip3.png 818w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip3-300x131.png 300w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2018\/03\/domain_to_ip3-768x336.png 768w\" alt=\"Domain to IP converter - programminginpython.com\" width=\"818\" height=\"358\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 818px; --smush-placeholder-aspect-ratio: 818\/358;\" \/><figcaption id=\"caption-attachment-966\" class=\"wp-caption-text\">Domain to IP converter \u2013 programminginpython.com<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone! Welcome back to programminginpython.com. Here in this post, I will show\u00a0you how to create a simple\u00a0domain to IP converter app in python GUI using TKInter. This app basically converts a domain name like &hellip;<\/p>\n","protected":false},"author":1,"featured_media":323,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[95,52,51,94],"class_list":["post-41","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-gui","tag-domain-to-ip-converter","tag-gui","tag-python-gui","tag-tkinter"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python<\/title>\n<meta name=\"description\" content=\"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python\" \/>\n<meta property=\"og:description\" content=\"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/\" \/>\n<meta property=\"og:site_name\" content=\"Programming In Python\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/programminginpython\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-12T04:56:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-08T18:39:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"AVINASH NETHALA\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@python_pip\" \/>\n<meta name=\"twitter:site\" content=\"@python_pip\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"AVINASH NETHALA\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","description":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/","og_locale":"en_US","og_type":"article","og_title":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","og_description":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","og_url":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/","og_site_name":"Programming In Python","article_publisher":"https:\/\/www.facebook.com\/programminginpython","article_published_time":"2022-05-12T04:56:53+00:00","article_modified_time":"2023-05-08T18:39:47+00:00","og_image":[{"width":1920,"height":400,"url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","type":"image\/png"}],"author":"AVINASH NETHALA","twitter_card":"summary_large_image","twitter_creator":"@python_pip","twitter_site":"@python_pip","twitter_misc":{"Written by":"AVINASH NETHALA","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#article","isPartOf":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/"},"author":{"name":"AVINASH NETHALA","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/9a3c14fe46d422ebf783ee61de1e788c"},"headline":"How to create a Domain to IP converter in Python GUI using TKInter","datePublished":"2022-05-12T04:56:53+00:00","dateModified":"2023-05-08T18:39:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/"},"wordCount":696,"commentCount":0,"publisher":{"@id":"https:\/\/www.programminginpython.com\/#organization"},"image":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","keywords":["domain to IP converter","GUI","python GUI","tkinter"],"articleSection":["Python GUI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/","url":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/","name":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","isPartOf":{"@id":"https:\/\/www.programminginpython.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#primaryimage"},"image":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","datePublished":"2022-05-12T04:56:53+00:00","dateModified":"2023-05-08T18:39:47+00:00","description":"How to create a Domain to IP converter in Python GUI using TKInter - Programming In Python","breadcrumb":{"@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#primaryimage","url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","contentUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","width":1920,"height":400,"caption":"How to create a Domain to IP converter in Python GUI using TKInter"},{"@type":"BreadcrumbList","@id":"https:\/\/www.programminginpython.com\/how-to-create-domain-to-ip-converter-python-gui-tkinter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.programminginpython.com\/"},{"@type":"ListItem","position":2,"name":"How to create a Domain to IP converter in Python GUI using TKInter"}]},{"@type":"WebSite","@id":"https:\/\/www.programminginpython.com\/#website","url":"https:\/\/www.programminginpython.com\/","name":"Programming In Python","description":"All About Python","publisher":{"@id":"https:\/\/www.programminginpython.com\/#organization"},"alternateName":"pip","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.programminginpython.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.programminginpython.com\/#organization","name":"Programming In Python","alternateName":"PIP","url":"https:\/\/www.programminginpython.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/04\/pip_logo_500_500.png","contentUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/04\/pip_logo_500_500.png","width":500,"height":500,"caption":"Programming In Python"},"image":{"@id":"https:\/\/www.programminginpython.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/programminginpython","https:\/\/x.com\/python_pip","https:\/\/www.youtube.com\/programminginpython","https:\/\/github.com\/avinashn\/programminginpython.com"]},{"@type":"Person","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/9a3c14fe46d422ebf783ee61de1e788c","name":"AVINASH NETHALA","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed52e7670d7db94820c7430d324103ccdecb16d86611d5b29064aa9ce25a958b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed52e7670d7db94820c7430d324103ccdecb16d86611d5b29064aa9ce25a958b?s=96&d=mm&r=g","caption":"AVINASH NETHALA"},"sameAs":["https:\/\/www.programminginpython.com\/"],"url":"https:\/\/www.programminginpython.com\/author\/avinash\/"}]}},"jetpack_featured_media_url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/Domain-to-IP-Python-GUI1.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":4,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":325,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/41\/revisions\/325"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/media\/323"}],"wp:attachment":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}