<commit_before>#!/usr/bin/env python
# help from <NAME> at psych0tik.net
# Clearly I don't use Python much!!!

from threading import Thread
import subprocess
from tkinter import *
from queue import Queue
import time
import os
import signal
import shlex

class Application(Frame):
        def __init__(self, master):
                self.myParent = master;
                super(Application, self).__init__(master)
                self.active = False;
                self.process = None
                self.grid()
                self.create_widgets()

        def work(self, cmd):
                if self.process:
                    self.process.kill()
                self.process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
		
                def update_textbox():
                    self.line = self.process.stdout.readline()
                    self.line = self.line.decode("utf-8")
                    self.textbox.insert(END, self.line)
                    self.myParent.after(0, update_textbox)
                update_textbox()


        def worker(self, string):
                self.active = False;
                print("pressed the bum button\n")
                t = Thread(target=self.work, args=(string,))
                t.start()


        def start(self):
                cmd = self.entry.get()
                self.worker(cmd)

        def stop(self):
                #os.kill(self.process.pid, signal.SIGKILL)
                self.process.terminate()

        def create_widgets(self):
                # This stuff gives me nightmares...nevermind!
                self.frame = Frame(self)
                self.frame.grid()
                #self.label = Label(self.frame, text = "Run").grid(row=0, column = 0)
                self.entry = Entry(self.frame)
                self.entry.grid(row=1, column = 0)
                self.button = Button(self.frame, text = "Run", command = self.start).grid(row=2, column=0)

                self.stop_button = Button(self.frame, text = "Stop", command = self.stop)
                self.stop_button.grid(row=3, column = 0)

                self.textbox = Text(self.frame, width=400)
                self.textbox.grid(row=5, column = 4,sticky=W+E+N+S)
def main():
        root = Tk()
        root.title("I've got the Bogotron blues...")
        root.geometry("500x400")
        app = Application(root)
        root.mainloop()

if __name__ == "__main__":
        main()
<commit_msg>almost workingl<commit_after>#!/usr/bin/env python
# help from richo healey at psych0tik.net
# Clearly I don't use Python much!!!

from threading import Thread
import subprocess
from tkinter import *
from queue import Queue
import time
import os
import signal
import shlex

class Application(Frame):
        def __init__(self, master):
                self.myParent = master;
                super(Application, self).__init__(master)
                self.active = False;
                self.process = None
                self.grid()
                self.create_widgets()

        def work(self, cmd):
                if self.process:
                    self.process.terminate() 
                    self.active = False;
                    return

                self.process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
	
                while True: #self.process.poll() is None:
                    output = self.process.stdout.readline()
                    if output == '':
                        break
                    output = output.decode("utf-8")
                    self.textbox.insert(INSERT, output)

        def worker(self, string):
                self.active = True;
                print("pressed the bum button\n")
                t = Thread(target=self.work, args=(string,))
                t.start()


        def start(self):
                cmd = self.entry.get()
                if self.process:
                    print("nooooooo")	
                else:
                    self.worker(cmd)

        def stop(self):
                #os.kill(self.process.pid, signal.SIGKILL)
                self.process.terminate()
                self.process = None
                self.active = False;

        def create_widgets(self):
                # This stuff gives me nightmares...nevermind!
                self.frame = Frame(self)
                self.frame.grid()
                #self.label = Label(self.frame, text = "Run").grid(row=0, column = 0)
                self.entry = Entry(self.frame)
                self.entry.grid(row=1, column = 0)
                self.button = Button(self.frame, text = "Run", command = self.start).grid(row=2, column=0)

                self.stop_button = Button(self.frame, text = "Stop", command = self.stop)
                self.stop_button.grid(row=3, column = 0)

                self.textbox = Text(self.frame, width=400)
                self.textbox.grid(row=5, column = 4,sticky=W+E+N+S)
def main():
        root = Tk()
        root.title("I've got the Bogotron blues...")
        root.geometry("500x400")
        app = Application(root)
        root.mainloop()

if __name__ == "__main__":
        main()

{'fraction_non_alphanumeric': 0.11183330147199388, 'fraction_numerical': 0.008220225578283311, 'mean_word_length': 1.5760709010339735, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5332090', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1403, 'n_words': 324}