Show current DNS servers

A python program that show current DNS servers setting (show content of /etc/resolv.conf)

์Program Windows
Program Window

code - tkinter

PYTHON
#!/usr/bin/python3
import tkinter as tk

# create root window
root = tk.Tk()

# root window title and dimension
root.title("DNS server")
# Set geometry(widthxheight)
root.geometry('600x230')

# Create text widget and specify size.
T = tk.Text(root, height = 5, width = 52, font=("Helvetica",16))
T.pack(pady=20,padx=20)
with open('/etc/resolv.conf') as f:
    content = f.readlines()
    # Insert content to textbox
    for line in content:
        T.insert(tk.END, line)
T.config(state=tk.DISABLED)

# Button for closing 
exit_button = tk.Button(root, text="Exit", height=1, width=10,font=("Helvetica",12),command=root.quit) 
exit_button.pack() 

# Execute Tkinter
root.mainloop()
Click to expand and view more

Copyright Notice

Author: Vorasilp K.

Link: https://vorasilp.xom/posts/show-current-dns-servers/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut