python - problems with the update of a label Tkinter -


i'm stuck on basilary things: have code

from tkinter import * import sys  import subprocess  import tkinter tk  def cd():       f=(subprocess.check_output("net view"))     e=(f.decode(sys.stdout.encoding))     label1=label(text=e).pack()   def mainscreen():      mainscreen=tk()     mainscreen.title("terfysgol's kit v 2.0")     frame1=frame(mainscreen)     frame1.pack()     puls1=button(frame1,text="list of device", borderwidth= "2",command= cd).pack()  mainscreen() 

when run time press button create new label want update text of label1.

this after:

def cd():      f=(subprocess.check_output("net view"))     e=(f.decode(sys.stdout.encoding))     label1.config(text = e) 

and @ top of program after imports need put:

label1 = label() label1.pack() 

please note i'm not suggesting program structure, sort out. answer quick fix provide enough information work out rest of need.

also can remove import tkinter tk line imports tkinter.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -