<commit_before>"""
Adapted from: http://www.datadependence.com/2016/04/how-to-build-gui-in-python-3/
"""
 
try:
    import tkinter as tk #Python 3.x
    from tkinter import ttk as ttk
except ImportError:
    import Tkinter as tk # Python 2.x
    import ttk as ttk
     
class carrierEntry(tk.Frame):
    
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.root = parent
        self.init_gui()
 
    def on_quit(self):
        # Exits program.
        quit()
 
    def submit(self):
        # Fetch entered values
        
        catid = self.catid_entry.get()
        volumeNo = self.volumeNo_entry.get()
        noVolumes = self.noVolumes_entry.get()
        carrierType = self.v.get()
        
        self.answer_label['text'] = catid
        
        print(catid,volumeNo,noVolumes)
        print(self.v.get())
        
        # Reset entry fields
        
        self.catid_entry.delete(0, tk.END)
        self.volumeNo_entry.delete(0, tk.END)
        self.noVolumes_entry.delete(0, tk.END)
        
    def init_gui(self):
        # Build GUI
        self.root.title('iromlab')
        self.root.option_add('*tearOff', 'FALSE')
 
        self.grid(column=0, row=0, sticky='nsew')
 
        tk.Label(self, text='Enter carrier details').grid(column=0, row=0,
                columnspan=4)
       
        ttk.Separator(self, orient='horizontal').grid(column=0,
                row=1, columnspan=4, sticky='ew')
                
        # Catalog ID        
        tk.Label(self, text='Catalog ID (PPN)').grid(column=0, row=2,
                sticky='w')
        self.catid_entry = tk.Entry(self, width=10)
        self.catid_entry.grid(column=2, row = 2)

        # Volume number
        tk.Label(self, text='Volume number').grid(column=0, row=3,
                sticky='w')
        self.volumeNo_entry = tk.Entry(self, width=5)
        self.volumeNo_entry.grid(column=2, row=3)

        # Number of volumes
        tk.Label(self, text='Number of volumes').grid(column=0, row=4,
                sticky='w')
        self.noVolumes_entry = tk.Entry(self, width=5)
        self.noVolumes_entry.grid(column=2, row=4)
 
        # Carrier type (radio button select)
        self.v = tk.IntVar()
        self.v.set(1)
        
        tk.Label(self, text='Carrier type:').grid(column=0, row=5,
                sticky='w', columnspan=4)
        
        # List with all possible carrier types + corresponding button codes
        carrierTypes = [
            ('cd-audio',1),
            ('cd-rom',2),
            ('dvd-rom',3),
            ('dvd-video',4)
        ]
        
        rowValue = 6
        
        for carrierType in carrierTypes:
            self.rb = tk.Radiobutton(self, text=carrierType[0], variable=self.v, value=carrierType[1]).grid(column=0, row=rowValue, 
            sticky='w')
            rowValue += 1
        
        self.submit_button = tk.Button(self, text='Submit',
                command=self.submit)
        self.submit_button.grid(column=0, row=10, columnspan=4)
        
        self.submit_button = tk.Button(self, text='Quit',
                command=self.on_quit)
        self.submit_button.grid(column=2, row=10, columnspan=4)
 
        self.answer_frame = tk.LabelFrame(self, text='Answer',
                height=100)
        self.answer_frame.grid(column=0, row=11, columnspan=4, sticky='nesw')
 
        self.answer_label = tk.Label(self.answer_frame, text='')
        self.answer_label.grid(column=0, row=0)<commit_msg>minor GUI layout tweaks<commit_after>"""
Adapted from: http://www.datadependence.com/2016/04/how-to-build-gui-in-python-3/
"""
 
try:
    import tkinter as tk #Python 3.x
    from tkinter import ttk as ttk
except ImportError:
    import Tkinter as tk # Python 2.x
    import ttk as ttk
     
class carrierEntry(tk.Frame):
    
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.root = parent
        self.init_gui()
 
    def on_quit(self):
        # Exits program.
        quit()
 
    def submit(self):
        # Fetch entered values
        
        catid = self.catid_entry.get()
        volumeNo = self.volumeNo_entry.get()
        noVolumes = self.noVolumes_entry.get()
        carrierType = self.v.get()
        
        self.answer_label['text'] = catid
        
        print(catid,volumeNo,noVolumes)
        print(self.v.get())
        
        # Reset entry fields
        
        self.catid_entry.delete(0, tk.END)
        self.volumeNo_entry.delete(0, tk.END)
        self.noVolumes_entry.delete(0, tk.END)
        
    def init_gui(self):
        # Build GUI
        self.root.title('iromlab')
        self.root.option_add('*tearOff', 'FALSE')
 
        self.grid(column=0, row=0, sticky='nsew')
 
        tk.Label(self, text='Enter carrier details').grid(column=0, row=0,
                columnspan=4)
       
        ttk.Separator(self, orient='horizontal').grid(column=0,
                row=1, columnspan=4, sticky='ew')
                
        # Catalog ID        
        tk.Label(self, text='Catalog ID (PPN)').grid(column=0, row=2,
                sticky='w')
        self.catid_entry = tk.Entry(self, width=10)
        self.catid_entry.grid(column=2, row = 2)

        # Volume number
        tk.Label(self, text='Volume number').grid(column=0, row=3,
                sticky='w')
        self.volumeNo_entry = tk.Entry(self, width=5)
        self.volumeNo_entry.grid(column=2, row=3)

        # Number of volumes
        tk.Label(self, text='Number of volumes').grid(column=0, row=4,
                sticky='w')
        self.noVolumes_entry = tk.Entry(self, width=5)
        self.noVolumes_entry.grid(column=2, row=4)
 
        # Carrier type (radio button select)
        self.v = tk.IntVar()
        self.v.set(1)
        
        tk.Label(self, text='Carrier type').grid(column=0, row=5,
                sticky='w', columnspan=4)
        
        # List with all possible carrier types + corresponding button codes
        carrierTypes = [
            ('cd-audio',1),
            ('cd-rom',2),
            ('dvd-rom',3),
            ('dvd-video',4)
        ]
        
        rowValue = 5
        
        for carrierType in carrierTypes:
            self.rb = tk.Radiobutton(self, text=carrierType[0], variable=self.v, value=carrierType[1]).grid(column=2, row=rowValue, 
            sticky='w')
            rowValue += 1
        
        self.submit_button = tk.Button(self, text='Submit',
                command=self.submit)
        self.submit_button.grid(column=0, row=11,  columnspan=3)
        
        self.submit_button = tk.Button(self, text='Quit',
                command=self.on_quit)
        self.submit_button.grid(column=2, row=11,  columnspan=3)
 
        self.answer_frame = tk.LabelFrame(self, text='Answer',
                height=100)
        self.answer_frame.grid(column=0, row=12, columnspan=4, sticky='nesw')
 
        self.answer_label = tk.Label(self.answer_frame, text='')
        self.answer_label.grid(column=0, row=0)
{'fraction_non_alphanumeric': 0.13095069925130667, 'fraction_numerical': 0.018646701511512924, 'mean_word_length': 1.977291841883936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '4688716', 'n_tokens_mistral': 2412, 'n_tokens_neox': 2290, 'n_words': 412}