Code: Alles auswählen
class meinThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
fping(stop)
stop = False
def startButton():
startButton.config(state=DISABLED)
t1 = meinThread()
t1.start()
def stopButton():
checkForStop()
def endButton():
pass
def fping(stop):
while stop == False:
command = 'Fping 192.168.1.10 -t 5 -s 500 -n 5 -L output.txt'
process = subprocess.Popen(command, shell=True)
def checkForStop():
global stop
stop = True
startButton = Button(window,text="Start",
relief='flat',background=bg,
fg='white',
width=10,
font=labelFont,
activebackground="#666666",
activeforeground='white',
command=startButton)
stopButton = Button(window,text="Stop",
relief='flat',background=bg,
fg='white',
width=10,
font=labelFont,
activebackground="#666666",
activeforeground='white',
command=stopButton)
beendenButton = Button(window,text="Beenden",
relief='flat',background=bg,
fg='white',
width=10,
font=labelFont,
activebackground="#666666",
activeforeground='white'
)