I have been working on with this code and I get my output to the terminal. How do i get the output to print in the tkinter GUI window insted? Here's the code:
import sys import os from tkinter import * def ping(): myinptext = entry.get() os.system("ping "+entry.get()+" -c 2" ) myGui = Tk() entry = StringVar() myGui.geometry('300x300') myGui.title("Get output inside GUI") mylabel = Label(myGui,text="Enter target IP or host as required.").pack() mybutton = Button(myGui,text ="Ping Test",command = ping).pack() myEntry = Entry(myGui,textvariable=entry).pack() myGui.mainloop()
stdoutWidget(...).pack()returnsNoneso you assignNonetomylabel,mybuttonandmyEntry. If you really need variablemylabelyou have to do in two stepsmylabel = Label(..)andmylabel.pack(). But in your example you don't need this variables so you can do without variables -Label(...).pack()