I'm making a GUI with python and tkinter That prompts user the Mac Address of his pc and asks for a code
The Python snippet i have used for retrieving the MAc address is :
import uuid
def get_mac():
mac_num = hex(uuid.getnode()).replace('0x', '').upper()
mac = ''.join(mac_num[i : i + 2] for i in range(0, 11, 2))
return mac
x= get_mac()
print x
I have also made a gui containing the two fields as shown below
However when i execute the python snippet the mac address is displayed outside the python gui and in the python shell, how can i make the mac address appear in the space provided in the GUi itself
Here is the code for the gui:
from Tkinter import *
from ttk import *
root =Tk()
def show_form():
bottomFrame = Frame(root)
bottomFrame.pack(side=BOTTOM)
b = Button(bottomFrame,text="ACTIVATE",command=lambda: show_call_back(root))
b1 = Button(bottomFrame, text="TRIM")
b2 = Button(bottomFrame, text="OVERLAY")
b3 = Button(bottomFrame, text="MERGE")
b.pack(side=RIGHT,padx=8,pady=26)
b1.pack(side=LEFT, padx=8, pady=26)
b1.config(state='disabled')
b2.pack(side=LEFT, padx=8, pady=26)
b2.config(state='disabled')
b3.pack(side=LEFT, padx=8, pady=26)
b3.config(state='disabled')
root.mainloop()
def show_call_back(parent):
top = Toplevel(parent)
top.geometry("250x200+600+250")
top.resizable(width=False, height=False)
top.title("Activation")
Label(top, text="Mac Address:",).grid(row=0, sticky=W, padx=4)
Label(top, text="Code").grid(row=1, sticky=W, padx=4)
Entry(top).grid(row=1, column=1, sticky=E, pady=4)
Button(top, text="Submit", command=top.destroy).grid(row=2, column=1)
show_form()
root.mainloop()