title: Is there a better way to do this python
body: <p>Just started to learn Socket and Tkinter i want a cleaner and a better way to do this.The most important thing i want to get is automating label sizing so that it's height will be equal to it's counter</p>
  
  <pre><code>from tkinter import *
  import socket
  
  #Initialize Tkinter
  win = Tk()
  
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Taking socket 
  information
  
  server = "pythonprogramming.net"
  port = 80
  server_ip = socket.gethostbyname(server)
  
  frame_server_inventory = Frame(win, relief="raised", borderwidth=3)
  
  label_tell_ip = Label(frame_server_inventory, text="IP:   " , borderwidth=3 , 
  width=6, relief="raised",anchor="center")
  label_tell_ip.grid(row=0 , column = 0) #Ip indicator
  
  label_tell_header = Label(frame_server_inventory, 
  text="Header",borderwidth=3,height=24,width=6, relief="raised")
  label_tell_header.grid(row=18 , column=0)
  
  frame_server_inventory.grid()
  
  get_request = "GET / HTTP/1.1\nHost:"+server+"\n\n"
  sock.connect((server,port))
  sock.send(get_request.encode())
  result = sock.recv(2048)
  
  frame_server_item= Frame(win,relief="raised",borderwidth=3)
  frame_server_item.grid(row=0 , column=1)
  
  label_ip = Label(frame_server_item, text=server_ip,borderwidth=3, width=70 , 
  relief="raised")
  label_ip.grid(row=0) # Displays Server IP
  
  label_header = Label(frame_server_item, text= result, 
  borderwidth=3,height=24,width=70 , relief="raised")
  label_header.grid(row=1)
  
  
  #Keeps The loop running
  win.mainloop()
  </code></pre>