'Can't print a multi line string in my label
from tkinter import *
import os
root = Tk()
root.title('Wifi Lookup Tool')
root.geometry('600x398')
root.config(bg='purple')
root.resizable(False, False)
label1 = Label(root, text="Enter network name:", bg='#070531', fg='white')
entry = Entry(root, width=40)
label2 = Label(root, text="Scan Results:", bg='#070531', fg='white')
label3 = Label(root, text="Lookup Results:", bg='#070531', fg='white')
output1 = Label(root, height=20, width=35)
output2 = Label(root, height=20, width=35)
label1.grid(row=0, column=0, sticky=E)
entry.grid(row=0, column=1, sticky=W)
label2.grid(row=2, column=0, sticky=NW, pady=5, padx=85)
label3.grid(row=2, column=1, sticky=N, pady=5)
output1.grid(row=2, column=0, pady=25, sticky=W)
output2.grid(row=2, column=1)
def scan():
sc = str(os.system("netsh wlan show profiles"))
output1.configure(text=sc)
def netlookup():
name = entry.get()
nl = str(os.system("netsh wlan show profile " + name + " key=clear"))
output2.configure(text=nl)
button1 = Button(root, text="Scan for networks", command=scan)
button1.grid(row=1, column=0, sticky=W, pady=10, padx=70)
button2 = Button(root, text="Network lookup", command=netlookup)
button2.grid(row=1, column=1, sticky=W, padx=120, ipadx=8)
root.mainloop()
When I press any of the two buttons it prints out in the label a 0. Also tried the StringVar() method, doesn't work. It prints the result in the console instead.
I'm trying to make it a multi-line string and put it in the output labels.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
