Exemplo n.º 1
0
    def _init_prodframe(self):
        self._prodframe = Frame(self._top)

        # Create the basic Text widget & scrollbar.
        self._textwidget = Text(self._prodframe,
                                background='#e0e0e0',
                                exportselection=1)
        self._textscroll = Scrollbar(self._prodframe,
                                     takefocus=0,
                                     orient='vertical')
        self._textwidget.config(yscrollcommand=self._textscroll.set)
        self._textscroll.config(command=self._textwidget.yview)
        self._textscroll.pack(side='right', fill='y')
        self._textwidget.pack(expand=1, fill='both', side='left')

        # Initialize the colorization tags.  Each nonterminal gets its
        # own tag, so they aren't listed here.
        self._textwidget.tag_config('terminal', foreground='#006000')
        self._textwidget.tag_config('arrow', font='symbol')
        self._textwidget.tag_config('error', background='red')

        # Keep track of what line they're on.  We use that to remember
        # to re-analyze a line whenever they leave it.
        self._linenum = 0

        # Expand "->" to an arrow.
        self._top.bind('>', self._replace_arrows)

        # Re-colorize lines when appropriate.
        self._top.bind('<<Paste>>', self._analyze)
        self._top.bind('<KeyPress>', self._check_analyze)
        self._top.bind('<ButtonPress>', self._check_analyze)

        # Tab cycles focus. (why doesn't this work??)
        def cycle(e, textwidget=self._textwidget):
            textwidget.tk_focusNext().focus()

        self._textwidget.bind('<Tab>', cycle)

        prod_tuples = [(p.lhs(), [p.rhs()]) for p in self._cfg.productions()]
        for i in range(len(prod_tuples) - 1, 0, -1):
            if (prod_tuples[i][0] == prod_tuples[i - 1][0]):
                if () in prod_tuples[i][1]: continue
                if () in prod_tuples[i - 1][1]: continue
                print(prod_tuples[i - 1][1])
                print(prod_tuples[i][1])
                prod_tuples[i - 1][1].extend(prod_tuples[i][1])
                del prod_tuples[i]

        for lhs, rhss in prod_tuples:
            print(lhs, rhss)
            s = '%s ->' % lhs
            for rhs in rhss:
                for elt in rhs:
                    if isinstance(elt, Nonterminal): s += ' %s' % elt
                    else: s += ' %r' % elt
                s += ' |'
            s = s[:-2] + '\n'
            self._textwidget.insert('end', s)

        self._analyze()
Exemplo n.º 2
0
menu_bar.add_cascade(label='About',  menu=about_menu)
root.config(menu=menu_bar)

shortcut_bar = Frame(root,  height=25)
shortcut_bar.pack(expand='no', fill='x')

icons = ('new_file', 'open_file', 'save', 'cut', 'copy', 'paste',
         'undo', 'redo', 'find_text','exit_editor')
for i, icon in enumerate(icons):
    tool_bar_icon = PhotoImage(file='icons/{}.png'.format(icon))
    cmd = eval(icon)
    tool_bar = Button(shortcut_bar, image=tool_bar_icon, command=cmd)
    tool_bar.image = tool_bar_icon
    tool_bar.pack(side='left')

line_number_bar = Text(root, width=4, padx=3, takefocus=0,  border=0,
                       background='khaki', state='disabled',  wrap='none')
line_number_bar.pack(side='left',  fill='y')

content_text = Text(root, wrap='word', undo=1)
content_text.pack(expand='yes', fill='both')
scroll_bar = Scrollbar(content_text)
content_text.configure(yscrollcommand=scroll_bar.set)
scroll_bar.config(command=content_text.yview)
scroll_bar.pack(side='right', fill='y')
cursor_info_bar = Label(content_text, text='Line: 1 | Column: 1')
cursor_info_bar.pack(expand='no', fill=None, side='right', anchor='se')


content_text.bind('<Control-N>', new_file)
content_text.bind('<Control-n>', new_file)
content_text.bind('<Control-O>', open_file)
Exemplo n.º 3
0
    def init_ui(self):
        """ setup the GUI for the app """
        self.master.title("Test")
        self.pack(fill=BOTH, expand=True)

        # Input section
        input_frame = LabelFrame(self, text="Input")
        input_frame.bind("-", self.on_minus_key)
        input_frame.bind("+", self.on_plus_key)
        input_frame.pack(fill=X)
        self.play_button = Button(input_frame,
                                  text="Play",
                                  command=self.on_play_button_click)
        self.play_button.pack(side=RIGHT, padx=4)
        self.rec_button = Button(input_frame,
                                 text="Rec",
                                 command=self.on_rec_button_click)
        self.rec_button.pack(side=RIGHT, padx=4)
        self.wav_filename_entry = Entry(input_frame, width=24)
        self.wav_filename_entry.pack(fill=X)
        self.wav_filename_entry.delete(0, END)
        if self.wav_filename:
            self.wav_filename_entry.insert(0, self.wav_filename)

        # Feature section
        features_frame = LabelFrame(self, text="Features")
        features_frame.pack(fill=X)

        features_control_frame = Frame(features_frame)
        features_control_frame.pack(fill=X)
        load_features_button = Button(features_control_frame,
                                      text="Load",
                                      command=self.on_load_featurizer_model)
        load_features_button.pack(side=RIGHT)
        self.features_entry = Entry(features_control_frame, width=8)
        self.features_entry.pack(fill=X)
        self.features_entry.delete(0, END)
        if self.featurizer_model:
            self.features_entry.insert(0, self.featurizer_model)

        viz_frame = Frame(features_frame)
        viz_frame.pack(fill=X)
        self.features_figure = Figure(figsize=(5, 4), dpi=100)
        self.subplot = self.features_figure.add_subplot(111)

        canvas = FigureCanvasTkAgg(self.features_figure, master=viz_frame)
        canvas.draw()
        canvas.show()
        canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=True)

        # Classifier section
        classifier_frame = LabelFrame(self, text="Classifier")
        classifier_frame.pack(fill=X)
        load_classifier_button = Button(classifier_frame,
                                        text="Load",
                                        command=self.on_load_classifier)
        load_classifier_button.pack(side=RIGHT)
        self.classifier_entry = Entry(classifier_frame, width=8)
        self.classifier_entry.pack(fill=X)
        self.classifier_entry.delete(0, END)
        if self.classifier_model:
            self.classifier_entry.insert(0, self.classifier_model)

        # Output section
        output_frame = LabelFrame(self, text="Output")
        output_frame.pack(fill=BOTH, expand=True)

        self.output_text = Text(output_frame)
        self.output_text.pack(fill=BOTH, padx=4, expand=True)
Exemplo n.º 4
0
    def __setup_form_widgets(self):
        # The frame which will draw our form
        self.form = Frame(self)

        entry_width = 30

        self.event_label = Label(self.form, text="Event Name: ")
        self.event = Entry(self.form, width=entry_width)

        self.time_label = Label(self.form, text="Start Time: ")
        self.time = Time(self.form)

        self.available_days_label = Label(self.form, text="Available Days: ")
        self.available_days = DaysToggle(self.form)

        # Start and end dates are entered by the user pressing
        # on a calander day. This way, we can ensure consistent
        # input that's in a format we always know
        self.start_label = Label(self.form, text="Start Date: ")
        self.start = DateEntry(
            self.form,
            width=entry_width,
            state='readonly',
            cursor='arrow',
            readonlybackground='',
            foreground='white',
            background='DeepSkyBlue4',
        )
        self.start.bind('<Button-1>', self.__set_focus)
        self.focus_date = self.start

        self.end_label = Label(self.form, text="End Date: ")
        self.end = DateEntry(
            self.form,
            width=entry_width,
            state='readonly',
            cursor='arrow',
            readonlybackground='',
            background='DarkSlateGray2',
        )
        self.end.bind('<Button-1>', self.__set_focus)

        self.hours_label = Label(self.form, text="Hours Needed: ")
        self.hours = Spinbox(self.form, from_=1, to=100, width=5)

        self.location_label = Label(self.form, text="Location: ")
        self.location = Entry(self.form, width=entry_width)

        self.description_label = Label(self.form, text="Description: ")
        self.description = Text(self.form,
                                height=5,
                                width=entry_width,
                                font='TkDefaultFont',
                                wrap=WORD)

        self.form_widgets = [
            (self.event_label, self.event),
            (self.time_label, self.time),
            (self.available_days_label, self.available_days),
            (self.start_label, self.start),
            (self.end_label, self.end),
            (self.hours_label, self.hours),
            (self.location_label, self.location),
            (self.description_label, self.description),
        ]
Exemplo n.º 5
0
    def __init__(self):
        self.root = Tk()
        self.root.title("LIU Vacuum Environment")
        self.root.minsize(1024, 768)
        self.root.resizable(width=True, height=True)

        self.agent_btn_dims = 22

        self.agent_img = dict()
        self.agent_img[(1, 0)] = PhotoImage(file="images/agent_east.png")
        self.agent_img[(0, 1)] = PhotoImage(file="images/agent_south.png")
        self.agent_img[(-1, 0)] = PhotoImage(file="images/agent_west.png")
        self.agent_img[(0, -1)] = PhotoImage(file="images/agent_north.png")

        self.images = {
            ENV_CLEAN: PhotoImage(file="images/blank.png"),
            ENV_DIRTY: PhotoImage(file="images/dirt.png"),
            ENV_WALL: PhotoImage(file="images/wall.png"),
            ENV_GOLD: PhotoImage(file="images/gold.png")
        }

        self.blank_img = PhotoImage(file="images/blank.png")

        # The outermost frame within which everything is contained
        self.host_frame = Frame(self.root)

        # Log window
        self.log = Text(self.host_frame, width=50, borderwidth=2)
        self.log.pack(side="right", expand=True, fill="y")
        self.log.configure(state="disabled")

        self.options_frame = Frame(self.host_frame)

        self.vacuum_env: LIUVacuumEnvironment = None
        self.grid_frame: Frame = None
        self.grid: list = None
        self.previous_dims: list = None
        self.is_running = False

        ### Option drop-down menus

        # Environment wall bias
        self.wall_bias_getter = self.create_selection_menu(
            self.update_all,
            *[(str(bias), bias) for bias in [0.0, 0.1, 0.2, 0.3, 0.4, 0.5]])

        # Environment dirt bias
        self.dirt_bias_getter = self.create_selection_menu(
            self.update_all,
            *[(str(bias), bias)
              for bias in [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]])

        # Environment PRF seed
        self.seed_getter = self.create_selection_menu(
            self.update_all,

            # Menu options
            ("Random", None),
            ("Seed 1", FIXED_SEED_1),
            ("Seed 2", FIXED_SEED_2),
            always_trigger_onselect=True)

        self.recon_getter = self.create_selection_menu(
            self.update_all, ("Full", "Full"), ("None", "None"),
            ("Summary", "Summary"),
            always_trigger_onselect=True)

        self.agent_getter = self.create_selection_menu(
            self.update_all,
            *list(map(lambda p: (p[1], p), agents())),
            always_trigger_onselect=True)

        # Continuous step delay
        self.delay_getter = self.create_selection_menu(
            None,
            *[(str(time) + "ms", time) for time in [100, 500, 10, 50, 1000]])

        def make_button(text, callback):
            """
            Shorthand for creating buttons along the top of the window

            :param text: Text to display in button
            :param callback: Button press callback
            :return: None
            """
            button = Button(self.options_frame, text=text)
            button.pack(side="left")
            button.config(command=callback)

        # Create buttons along top of window
        make_button("Prepare", self.update_all)
        make_button("Run", self.start)
        make_button("Stop", self.stop)
        make_button("Step", self.step)
        make_button("Clear Log", self.log_clear)

        # Finalize creation of holding frames
        self.options_frame.pack(side="top")
        self.host_frame.pack(expand=True, fill=BOTH)

        self.marked_agent_pos = (0, 0)
        self.marked_agent_rot = (1, 0)
        self.agent = None

        # Now that everything is properly initialized, do a full initialization of the state and graphics
        self.update_all(force=True)
Exemplo n.º 6
0
 def setUpClass(cls):
     requires('gui')
     root = cls.root = Tk()
     root.withdraw()
     w = cls.window = outwin.OutputWindow(None, None, None, root)
     cls.text = w.text = Text(root)
Exemplo n.º 7
0
    frame['width'] = 300
    frame['height'] = 300


def wrap_text(event):
    label['text'] = text.get('1.0', 'end')


if __name__ == '__main__':
    root = Tk()
    frame = Frame(root, width=100, height=100, bg='lime')
    button1 = Button(root, text="1")
    button2 = Button(root, text="2")
    button3 = Button(root, text="3")

    button1.bind("<Button-1>", button1_event)
    button2.bind("<Button-1>", button2_event)
    button3.bind("<Button-1>", button3_event)

    frame.pack()
    button1.pack()
    button2.pack()
    button3.pack()

    label = Label(root, text="Метка")
    text = Text(root, width=30, height=5, wrap='word')
    text.bind('<Return>', wrap_text)
    label.pack()
    text.pack()
    root.mainloop()
Exemplo n.º 8
0
    def __init__(self):
        self.__root = Tk()
        self.__root.title('Untitled - Text Editor')
        self.__root.geometry('640x320')
        ##ICON
        try:
            self.__root.wm_iconbitmap("note.ico")
        except:
            print("'note.ico' was not found in root directory.")

        self.__textArea = Text(self.__root, undo=True)

        self.__edited = False
        self.__filename = None

        self.__menubar = Menu(self.__root)
        self.__root.config(menu=self.__menubar)

        ###FILE MENU
        self.__fileMenu = Menu(self.__root, tearoff=0)
        self.__fileMenu.add_command(label='New', command=self.__new)
        self.__fileMenu.add_command(label='Open', command=self.__open)
        self.__fileMenu.add_separator()
        self.__fileMenu.add_command(label='Save', command=self.__save)
        self.__fileMenu.add_command(label='Save as', command=self.__saveas)
        self.__fileMenu.add_separator()
        self.__fileMenu.add_command(label='Exit', command=self.__exit)
        ##FILE submenu options
        self.__menubar.add_cascade(label='File', menu=self.__fileMenu)

        ###EDIT MENU
        self.__editMenu = Menu(self.__menubar, tearoff=0)
        ##EDIT submenu options
        self.__editMenu.add_command(label='Undo',
                                    command=self.__textArea.edit_undo)
        self.__editMenu.add_command(label='Redo',
                                    command=self.__textArea.edit_redo)
        self.__editMenu.add_separator()
        self.__editMenu.add_command(label="Cut", command=self.__cut)
        self.__editMenu.add_command(label="Copy", command=self.__copy)
        self.__editMenu.add_command(label="Paste", command=self.__paste)
        self.__menubar.add_cascade(label='Edit', menu=self.__editMenu)

        self.__root.grid_rowconfigure(0, weight=1)
        self.__root.grid_columnconfigure(0, weight=1)

        self.__textArea.grid(sticky=N + E + S + W)
        self.__scrollbar = Scrollbar(self.__textArea)

        ##scrollbar auto adjusting
        self.__scrollbar.pack(side=RIGHT, fill=Y)
        self.__scrollbar.config(command=self.__textArea.yview)
        self.__textArea.config(yscrollcommand=self.__scrollbar.set)

        ####menu shortcuts
        self.__root.bind('<Control-n>', lambda event: self.__new())
        self.__root.bind('<Control-o>', lambda event: self.__open())
        self.__root.bind('<Control-s>', lambda event: self.__save())
        self.__root.bind('<Control-Shift-s>', lambda event: self.__saveas())

        self.__root.mainloop()
Exemplo n.º 9
0
parameter_1_entry.grid(row=1, column=2)

# Parameter 2 information
parameter_2_label = Label(root, text="Parameter 2").grid(row=2,
                                                         column=0,
                                                         sticky="w")
p2_var = StringVar(root)
p2_var.set('Temperature')  # set the default option
parameter_2_menu = ttk.OptionMenu(root, p2_var, *helper.keys())
parameter_2_menu.grid(row=2, column=1)
parameter_2_entry = Entry(root, width=15)
parameter_2_entry.grid(row=2, column=2)

# Desired value to obtain.
des_label = Label(root, text="Desired Value").grid(row=3, column=0, sticky="w")
des_var = StringVar(root)
des_var.set('Enthalpy')  # set the default opti# on
des_menu = ttk.OptionMenu(root, des_var, *helper.keys())
des_menu.grid(row=3, column=1)

# Submit button
calculate_button = Button(root, text="Submit", command=submit_button)
calculate_button.grid(row=4, column=1)

# Results section
results_text = Text(root, width=50, height=8, selectborderwidth=2)
results_text.grid(row=5, columnspan=4, sticky='w')
results_label = Label(root, text="Results").grid(row=4, column=0)

root.mainloop()
Exemplo n.º 10
0
    def __init__(self, master):
        self.s3 = boto3.resource('s3')
        self.s3c = boto3.client('s3')
        light_gray = '#D9D9D9',
        blue = '#181B42',
        red = '#FF0000',
        black = '#000000',
        cyan = '#80DFFF'
        bold = 'Helvetica 10 bold underline'
        normal = 'Helvetica 10'
        rpath = realpath(__file__)[:-len(basename(__file__))]

        self.finish_thread = None
        self.greeting = 'Hello %s' % getuser()
        self.master = master
        self.master.title('Amazon S3 File Transfer Client')
        self.master.configure(bg=black)
        if platform != 'win32':
            desktop = {'plasma': '695x700', 'ubuntu': '625x700'}
            env = environ.get('DESKTOP_SESSION')
            if env is None or env not in desktop or env == 'ubunutu':
                self.master.maxsize('625', '700')
                self.master.minsize('625', '550')
            else:
                self.master.maxsize('695', '700')
                self.master.minsize('695', '550')

            self.master.geometry(desktop[env])
            self.icon = PhotoImage(file=rpath + 'icon.png')
            master.iconphoto(False, self.icon)

        else:
            self.master.geometry('485x600')
            self.master.iconbitmap(rpath + 'icon.ico')
            self.master.maxsize('485', '700')
            self.master.minsize('485', '550')
        menu = Menu(self.master)
        menu.config(background=black, fg=light_gray)
        self.master.config(menu=menu)
        file = Menu(menu)
        file.add_command(label='Exit', command=self.quit_app)
        menu.add_cascade(label='File', menu=file)
        refresh = Menu(menu)
        refresh.add_command(label='Local', command=self.refresh_local)
        refresh.add_command(label='S3', command=self.refresh_s3)
        menu.add_cascade(label='Refresh', menu=refresh)
        self.dir, self.drp_sel, self.bucket_name = ['' for _ in range(3)]
        self.folder_path = StringVar()
        self.dropdown = StringVar()
        self.dropdown_data = self.populate_dropdown()
        if not self.dropdown_data:
            self.dropdown_data = ['none available']
        self.deleted = False
        self.local_sel, self.s3_sel = ([] for _ in range(2))

        self.local_label = Label(master,
                                 fg=light_gray,
                                 bg=black,
                                 text='LOCAL FILE SYSTEM',
                                 font=bold,
                                 width=24)
        self.local_label.grid(row=0, column=0, sticky=E + W, padx=10, pady=20)
        self.s3_label = Label(master,
                              fg=light_gray,
                              bg=black,
                              text='AMAZON  S3',
                              font=bold,
                              underline=True,
                              width=24)
        self.s3_label.grid(row=0, column=1, sticky=E + W, padx=10, pady=20)
        self.dropdown_box = OptionMenu(master,
                                       self.dropdown,
                                       *self.dropdown_data,
                                       command=self.set_drop_val)
        self.dropdown_box.configure(fg=light_gray,
                                    bg=blue,
                                    width=16,
                                    highlightbackground=black,
                                    highlightthickness=2)
        self.dropdown_box.grid(row=1, column=1, sticky=E + W, padx=52, pady=10)
        self.browse_button = Button(master,
                                    fg=light_gray,
                                    bg=blue,
                                    text='Browse',
                                    width=16,
                                    highlightbackground=black,
                                    highlightthickness=2,
                                    command=self.load_dir)
        self.browse_button.grid(row=1,
                                column=0,
                                sticky=E + W,
                                padx=52,
                                pady=10)
        self.browse_label = Label(master,
                                  fg=light_gray,
                                  bg=black,
                                  text='No directory selected',
                                  width=24,
                                  font=normal)
        self.browse_label.grid(row=2, column=0, sticky=E + W, padx=10, pady=10)
        self.bucket_label = Label(master,
                                  fg=light_gray,
                                  bg=black,
                                  text='No bucket selected',
                                  width=24,
                                  font=normal)
        self.bucket_label.grid(row=2, column=1, sticky=E + W, padx=10, pady=10)
        self.refresh_btn_local = Button(master,
                                        fg=light_gray,
                                        bg=blue,
                                        text='REFRESH',
                                        width=10,
                                        highlightbackground=black,
                                        highlightthickness=2,
                                        command=self.refresh_local)
        self.refresh_btn_local.grid(row=3,
                                    column=0,
                                    sticky=E + W,
                                    padx=50,
                                    pady=10)
        self.refresh_btn_s3 = Button(master,
                                     fg=light_gray,
                                     bg=blue,
                                     text='REFRESH',
                                     width=10,
                                     highlightbackground=black,
                                     highlightthickness=2,
                                     command=self.refresh_s3)
        self.refresh_btn_s3.grid(row=3,
                                 column=1,
                                 sticky=E + W,
                                 padx=50,
                                 pady=10)

        self.ex_loc = Listbox(master,
                              fg=cyan,
                              bg=black,
                              width=36,
                              height=18,
                              highlightcolor=black,
                              selectmode='multiple')
        self.ex_loc.grid(row=5, column=0, sticky=E + W, padx=10, pady=10)
        self.ex_s3 = Listbox(master,
                             fg=cyan,
                             bg=black,
                             width=36,
                             height=18,
                             highlightcolor=black,
                             selectmode='multiple')
        self.ex_s3.grid(row=5, column=1, sticky=E + W, padx=10, pady=10)
        self.upload_button = Button(master,
                                    fg=light_gray,
                                    bg=blue,
                                    text='Upload ->',
                                    width=14,
                                    highlightbackground=black,
                                    highlightthickness=2,
                                    command=self.upload)
        self.upload_button.grid(row=6, column=0, sticky=E, padx=10, pady=10)
        self.download_button = Button(master,
                                      fg=light_gray,
                                      bg=blue,
                                      text='<- Download',
                                      width=14,
                                      highlightbackground=black,
                                      highlightthickness=2,
                                      command=self.download)
        self.download_button.grid(row=6, column=1, sticky=W, padx=10, pady=10)
        self.delete_local = Button(master,
                                   fg=light_gray,
                                   bg=blue,
                                   text='DELETE',
                                   width=14,
                                   highlightbackground=red,
                                   activebackground=red,
                                   command=self.delete_local_records)
        self.delete_local.grid(row=6, column=0, sticky=W, padx=10, pady=10)
        self.delete_s3 = Button(master,
                                fg=light_gray,
                                bg=blue,
                                text='DELETE',
                                width=14,
                                highlightbackground=red,
                                activebackground=red,
                                command=self.delete_s3_records)
        self.delete_s3.grid(row=6, column=1, sticky=E, padx=10, pady=10)
        self.found_label_local = Label(master,
                                       fg=light_gray,
                                       bg=black,
                                       text='found local',
                                       width=16)
        self.found_label_local.grid(row=7,
                                    column=0,
                                    sticky=E + W,
                                    padx=10,
                                    pady=10)
        self.found_label_s3 = Label(master,
                                    fg=light_gray,
                                    bg=black,
                                    text='found s3',
                                    width=16)
        self.found_label_s3.grid(row=7,
                                 column=1,
                                 sticky=E + W,
                                 padx=10,
                                 pady=10)
        self.status_label = Label(master,
                                  fg=light_gray,
                                  bg=black,
                                  text=self.greeting,
                                  width=8)
        self.status_label.grid(row=8, column=0, sticky=E + W, padx=10, pady=10)
        self.create_bucket_label = Label(master,
                                         fg=light_gray,
                                         bg=black,
                                         text='New Bucket:',
                                         width=10)
        self.create_bucket_label.grid(row=8,
                                      column=1,
                                      sticky=W,
                                      padx=1,
                                      pady=1)
        if platform != 'win32':
            self.create_bucket_name = Text(master,
                                           fg=cyan,
                                           bg=black,
                                           width=15,
                                           height=1)
            self.create_bucket_button = Button(master,
                                               fg=light_gray,
                                               bg=blue,
                                               text='Create',
                                               width=5,
                                               highlightbackground=black,
                                               highlightthickness=2,
                                               command=self.create_bucket)
        else:
            self.create_bucket_name = Text(master,
                                           fg=cyan,
                                           bg=black,
                                           width=11,
                                           height=1)
            self.create_bucket_button = Button(master,
                                               fg=light_gray,
                                               bg=blue,
                                               text='Create',
                                               width=7,
                                               highlightbackground=black,
                                               highlightthickness=2,
                                               command=self.create_bucket)
        self.create_bucket_name.grid(row=8, column=1, padx=1, pady=10)
        self.create_bucket_button.grid(row=8,
                                       column=1,
                                       sticky=E,
                                       padx=10,
                                       pady=10)

        self.master.grid_columnconfigure(0, weight=1)
        self.master.grid_columnconfigure(1, weight=1)
        self.master.grid_rowconfigure(5, weight=1)

        self.set_found_local_label('%d files found' % self.ex_loc.size())
        self.set_found_s3_label('%d files found' % self.ex_s3.size())
Exemplo n.º 11
0
 def setUpClass(cls):
     requires('gui')
     cls.root = Tk()
     macosx.setupApp(cls.root, None)
     cls.text = Text(cls.root)
     cls.editor = DummyEditwin(cls.root, cls.text)
Exemplo n.º 12
0
    coord_x, coord_y = entry_message.winfo_rootx(), entry_message.winfo_rooty(
    )  # fetching coordinates
    pyautogui.click(x=coord_x, y=coord_y)  # clicking on the text area
    msg = speechToText()  # converting to text
    pyautogui.write(msg, interval=0.01)  # writing message on Text Area

    return True


# Adding TKinter Utilities
if __name__ == '__main__':

    # Adding Utilities

    # Adding Label
    label_voice_input = Label(text='Your Message')
    label_voice_input.grid(row=0, column=0, pady=5)

    # Adding Text Area
    entry_message = Text(width=25, height=5)
    entry_message.grid(row=1, column=0, padx=47, pady=5)

    # Adding Button
    button_voice_type = Button(text='Voice Type',
                               bg='#000080',
                               fg='#ffffff',
                               command=writeOnSceen)
    button_voice_type.grid(row=2, column=0, pady=5)

    # Keeping TKinter Window Open
    root.mainloop()
Exemplo n.º 13
0
    def __init__(self, root) -> None:
        root.title("Text to QR")
        # setting window size
        width = 500
        height = 600
        screenwidth = root.winfo_screenwidth()
        screenheight = root.winfo_screenheight()
        align_window = f'{width}x{height}+{(screenwidth - width) // 2}+{(screenheight - height) // 2}'
        root.geometry(align_window)
        root.resizable(width=False, height=False)

        # fonts

        title_font = tkFont.Font(family='Times', size=16)
        enter_text_label_font = tkFont.Font(family='Times', size=12)
        display_qr_label_font = tkFont.Font(family='Times', size=10)
        # font for button elements
        button_font = tkFont.Font(family='Times', size=12)

        title_label = Label(root,
                            text="Text to QR Generator",
                            font=title_font,
                            justify="center")

        enter_text_label = Label(root,
                                 text="Enter Text",
                                 font=enter_text_label_font,
                                 justify="center")

        self.text_entry_box = Text(root)

        generate_button = Button(root,
                                 text="Generate Qr",
                                 font=button_font,
                                 justify="center",
                                 command=lambda: self.display_qr())

        self.display_qr_label = Label(root,
                                      text="QR code will be displayed here",
                                      font=display_qr_label_font, justify="center",
                                      borderwidth=2,
                                      relief="groove")

        save_button = Button(root,
                             text="Save",
                             font=button_font,
                             justify="center",
                             command=lambda: self.save_qr_as_image())

        exit_button = Button(root,
                             text="Exit",
                             font=button_font,
                             justify="center",
                             command=lambda: self.exit())

        # place all elements
        title_label.place(x=140, y=30, width=185, height=25)
        enter_text_label.place(x=20, y=80, width=70, height=25)
        self.text_entry_box.place(x=100, y=80, width=297, height=100)
        generate_button.place(x=195, y=190, width=85, height=25)
        self.display_qr_label.place(x=50, y=230, width=400, height=300)
        save_button.place(x=150, y=550, width=70, height=25)
        exit_button.place(x=250, y=550, width=70, height=25)

        self.temp_image_file = "QRCode.png"
Exemplo n.º 14
0
    def initialize_components(self):
        """
        Method that initialize the visual components for each form associated with the local administration
        """
        # Resources for the Forms
        self.new_icon = PhotoImage(file=r"./Resources/create.png")
        self.view_icon = PhotoImage(file=r"./Resources/view.png")
        self.modify_icon = PhotoImage(file=r"./Resources/modify.png")
        self.remove_icon = PhotoImage(file=r"./Resources/delete.png")
        self.save_icon = PhotoImage(file=r"./Resources/save.png")
        self.back_icon = PhotoImage(file=r"./Resources/back.png")
        self.cancel_icon = PhotoImage(file=r"./Resources/cancel.png")

        # Components for List FRM
        lbl_sep1 = Label(self.frm_child_list)
        lbl_sep1.grid(row=0, column=0, padx=10, pady=25)
        self.trv_available = Treeview(self.frm_child_list,
                                      height=15,
                                      columns=('N', 'Name', '# categories'))
        self.trv_available.heading('#0', text='ID', anchor=CENTER)
        self.trv_available.heading('#1', text='N', anchor=CENTER)
        self.trv_available.heading('#2', text='Name', anchor=CENTER)
        self.trv_available.heading('#3', text='# categories', anchor=CENTER)
        self.trv_available.column('#0', width=0, minwidth=50, stretch=NO)
        self.trv_available.column('#1', width=20, minwidth=20, stretch=NO)
        self.trv_available.column('#2', width=200, minwidth=200, stretch=NO)
        self.trv_available.column('#3', width=150, minwidth=150, stretch=NO)
        self.trv_available.grid(row=0, column=1, sticky=W, pady=25)
        vsb_trv_av = Scrollbar(self.frm_child_list,
                               orient="vertical",
                               command=self.trv_available.yview)
        vsb_trv_av.grid(row=0, column=2, pady=25, sticky=NS)
        self.trv_available.configure(yscrollcommand=vsb_trv_av.set)
        frm_aux4 = Frame(self.frm_child_list)
        btn_new = Button(frm_aux4, image=self.new_icon, command=self.click_new)
        btn_new.grid(row=0, column=0, pady=5, padx=5, sticky=E)
        btn_new_ttp = CreateToolTip(btn_new, 'New classification')
        btn_view = Button(frm_aux4,
                          image=self.view_icon,
                          command=self.click_view)
        btn_view.grid(row=1, column=0, pady=5, padx=5, sticky=E)
        btn_view_ttp = CreateToolTip(btn_view, 'View classification')
        btn_edit = Button(frm_aux4,
                          image=self.modify_icon,
                          command=self.click_update)
        btn_edit.grid(row=2, column=0, pady=5, padx=5, sticky=E)
        btn_edit_ttp = CreateToolTip(btn_edit, 'Edit classification')
        btn_delete = Button(frm_aux4,
                            image=self.remove_icon,
                            command=self.click_delete)
        btn_delete.grid(row=3, column=0, pady=5, padx=5, sticky=E)
        btn_delete_ttp = CreateToolTip(btn_delete, 'Delete classification')
        frm_aux4.grid(row=0, column=4, pady=25, padx=25, sticky=NW)

        # Components CRUD
        self.frm_class = LabelFrame(self.frm_child_crud)
        self.frm_class.config(fg=TEXT_COLOR, font=SUBTITLE_FONT)
        lbl_class = Label(self.frm_child_crud, text='Name*')
        lbl_class.config(fg=TEXT_COLOR, font=LABEL_FONT)
        lbl_class.grid(row=0, column=0, pady=10, padx=20, sticky=W)
        lbl_desc_categories = Label(
            self.frm_child_crud,
            text='Enter categories separated by an Enter (\\n)')
        lbl_desc_categories.config(fg=TEXT_COLOR, font=LABEL_FONT)
        lbl_desc_categories.grid(row=1,
                                 column=0,
                                 pady=10,
                                 padx=20,
                                 columnspan=4,
                                 sticky=W)
        lbl_categories = Label(self.frm_child_crud, text='Categories*')
        lbl_categories.config(fg=TEXT_COLOR, font=LABEL_FONT)
        lbl_categories.grid(row=2, column=0, pady=10, padx=20, sticky=NW)
        lbl_sep2 = Label(self.frm_child_crud)
        lbl_sep2.grid(row=2, column=1, padx=20, pady=10)
        self.txt_name_class = Entry(self.frm_child_crud,
                                    width=50,
                                    font=TEXT_FONT)
        self.txt_name_class.grid(row=0,
                                 column=2,
                                 columnspan=2,
                                 pady=10,
                                 sticky=W)
        self.txt_categories = Text(self.frm_child_crud,
                                   height=10,
                                   width=50,
                                   font=TEXT_FONT)
        self.txt_categories.grid(row=2, column=2, pady=10, sticky=W)
        vsb_txt_cat = Scrollbar(self.frm_child_crud,
                                orient="vertical",
                                command=self.txt_categories.yview)
        vsb_txt_cat.grid(row=2, column=3, pady=10, sticky=NS)
        self.txt_categories.configure(yscrollcommand=vsb_txt_cat.set)
        sep_aux1 = Separator(self.frm_child_crud, orient=VERTICAL)
        sep_aux1.grid(row=0, column=4, sticky=NS, rowspan=3, padx=20)
        self.btn_save = Button(self.frm_child_crud,
                               image=self.save_icon,
                               command=self.click_save)
        btn_save_ttp = CreateToolTip(self.btn_save, 'Save classification')
        self.btn_back = Button(self.frm_child_crud,
                               image=self.back_icon,
                               command=self.click_back)
        btn_back_ttp = CreateToolTip(self.btn_back, 'Go back')
        self.btn_cancel = Button(self.frm_child_crud,
                                 image=self.cancel_icon,
                                 command=self.click_cancel)
        btn_cancel_ttp = CreateToolTip(self.btn_cancel, 'Cancel')
Exemplo n.º 15
0
    for i in task_list:
        j = j + 1
    msg.showinfo("Number of tasks", j)


#Method to exit from the root window.
def exit():
    sys.exit()


#Label for printing -->>To-Do List<<-- on root wimdow.
label = Label(root, text="To-Do List", font="bold 20", width="10")
label.place(x=420, y=30)

#Entry for input as here user will enter the task to add in task_list(ListBox).
entry = Text(root, width=37, height="2")
# entry.insert("end",'Enter your task')
# entry.bind("<Button>",Add_Task)
entry.place(x=350, y=100)

#ListBox for keeping the all tasks.
mylist = Listbox(root, width=50, height=20)
mylist.place(x=350, y=180)

#Button for adding new tasks in task_list(ListBox).
add_item_button = Button(root,
                         text="Add to-do item",
                         command=add_task,
                         bg="lightgreen",
                         width=15,
                         font="5")
Exemplo n.º 16
0
import socket
import threading
from tkinter import Tk, Label, Text, Scrollbar, Entry, mainloop
from tkinter.constants import DISABLED, VERTICAL, NORMAL, END, NS

ventana = Tk()
titulo = Label(ventana, text="Chat Cliente_CarlosT", font="Verdana 15 bold")
textArea = Text(ventana, height=15, width=60)
scroll = Scrollbar(command=textArea.yview, orient=VERTICAL)
cajaTexto = Entry(ventana)

socket = socket.socket()
host = "localhost"
puerto = 9999
socket.connect((host, puerto))


def eventoEnviar(event):
    try:
        datos = ""
        datos = "\nCliente: " + cajaTexto.get().strip()
        insertarTexto(datos)
        socket.send(datos.encode(encoding='utf_8', errors="strict"))
        cajaTexto.delete(0, END)
        pass
    except:
        print("ERROR AL ENVIAR MENSAJE DESDE CLIENTE")


def insertarTexto(texto):
    textArea.config(state=NORMAL)
Exemplo n.º 17
0
    def __init__(self, master):
        self.master = master
        self.master.title("Expenses")
        self.master.geometry("250x170")
        self.master.resizable(False, False)
        self.categories = list(
            ["Bills/Taxes", "Grocery", "Transportation", "Other"])
        # folders
        foldercreate("expenses")
        nowyear = datetime.date.today().year
        foldercreate(str(nowyear))
        #csv file
        self.nowmonth = datetime.date.today().month
        self.filenamesave = ""
        if not os.path.exists('expenses' + str(self.nowmonth) + '.csv'):
            with open('expenses' + str(self.nowmonth) + '.csv', 'w') as f:
                thewriter = csv.writer(f)
                thewriter.writerow(
                    ['Date', 'Amount', 'Description', 'Category'])
        if not os.path.exists('expenses budget' + str(self.nowmonth) + '.csv'):
            with open('expenses budget' + str(self.nowmonth) + '.csv',
                      'w') as f:
                thewriter = csv.writer(f)
                thewriter.writerow(['Amount', 'Category'])
        self.menu = Menu(self.master)
        self.file_menu = Menu(self.menu, tearoff=0)
        self.file_menu.add_command(label="Add Expense",
                                   accelerator='Ctrl+O',
                                   command=self.addexp)
        self.file_menu.add_command(label="Save Overview as",
                                   accelerator='Ctrl+S',
                                   command=self.saveas)
        self.file_menu.add_command(label="Exit",
                                   accelerator='Alt+F4',
                                   command=self.exitmenu)
        self.menu.add_cascade(label="File", menu=self.file_menu)
        self.edit_menu = Menu(self.menu, tearoff=0)
        self.edit_menu.add_command(label="Clear Amount",
                                   accelerator='Ctrl+Z',
                                   command=self.clearamount)
        self.edit_menu.add_command(label="Clear Description",
                                   accelerator='Alt+Z',
                                   command=self.cleardes)
        self.menu.add_cascade(label="Edit", menu=self.edit_menu)
        self.budget_menu = Menu(self.menu, tearoff=0)
        self.submenu = Menu(self.budget_menu, tearoff=0)
        self.submenu.add_command(label="Set Grocery budget",
                                 accelerator='Alt+P',
                                 command=lambda: self.setbudget('Grocery'))
        self.submenu.add_command(label="Set Other budget",
                                 accelerator='Alt+Q',
                                 command=lambda: self.setbudget('Other'))
        self.submenu.add_command(
            label="Set Transportation budget",
            accelerator='Ctrl+Q',
            command=lambda: self.setbudget('Transportation'))
        self.submenu.add_command(label="Set Bills/Taxes",
                                 accelerator='Ctrl+W',
                                 command=lambda: self.setbudget('Bills/Taxes'))
        self.budget_menu.add_cascade(label="Set budget",
                                     menu=self.submenu,
                                     underline=0)
        self.budget_menu.add_command(label="Show budget",
                                     accelerator='Alt+F6',
                                     command=self.showbudget)
        self.menu.add_cascade(label="Budget", menu=self.budget_menu)
        self.charts = Menu(self.menu, tearoff=0)
        self.charts.add_command(label="Bar Chart",
                                accelerator='Ctrl+B',
                                command=lambda: self.Charts(
                                    "Bar Chart of Expenses", self.categories,
                                    'bar', ['r', 'g', 'y', 'b']))
        self.charts.add_command(label="Pie Chart",
                                accelerator='Ctrl+P',
                                command=lambda: self.Charts(
                                    "Pie Chart of Expenses", self.categories,
                                    'pie', ['r', 'g', 'y', 'b']))
        self.charts.add_command(label="Show time series m",
                                accelerator='Ctrl+T',
                                command=self.timeseriesmonth)
        self.menu.add_cascade(label="Charts", menu=self.charts)
        self.show = Menu(self.menu, tearoff=0)
        self.show.add_command(label="Show Monthly Other",
                              accelerator='Alt+O',
                              command=lambda: self.monthlyexpenses('Other'))
        self.show.add_command(
            label="Show Monthly Transportation",
            accelerator='Alt+T',
            command=lambda: self.monthlyexpenses('Transportation'))
        self.show.add_command(label="Show Monthly Grocery",
                              accelerator='Alt+G',
                              command=lambda: self.monthlyexpenses('Grocery'))
        self.show.add_command(
            label="Show Monthly Bills/Taxes",
            accelerator='Alt+B',
            command=lambda: self.monthlyexpenses('Bills/Taxes'))
        self.show.add_command(label='Show Monthly Expenses',
                              accelerator='Alt+S',
                              command=lambda: self.monthlyexpenses(None))
        self.show.add_command(label="Show Overview",
                              accelerator='Ctrl+N',
                              command=self.show_overview)
        self.show.add_command(label="Show Expenses Info",
                              accelerator='Alt+N',
                              command=self.show_expenses_info)
        self.menu.add_cascade(label="Show", menu=self.show)
        self.showtrans = Menu(self.menu, tearoff=0)
        self.showtrans.add_command(
            label="Show Number of Total Transactions",
            accelerator='Alt+W',
            command=lambda: self.monthlytransactions(None))
        self.showtrans.add_command(
            label="Show Number of (Other) Transactions",
            accelerator='Alt+I',
            command=lambda: self.monthlytransactions('Other'))
        self.showtrans.add_command(
            label="Show Number of (Transportation) Transactions",
            accelerator='Alt+E',
            command=lambda: self.monthlytransactions('Transportation'))
        self.showtrans.add_command(
            label="Show Number of (Grocery) Transactions",
            accelerator='Ctrl+E',
            command=lambda: self.monthlytransactions('Grocery'))
        self.showtrans.add_command(
            label="Show Number of (Bills/Taxes) Transactions",
            accelerator='Ctrl+Y',
            command=lambda: self.monthlytransactions('Bills/Taxes'))
        self.menu.add_cascade(label="Transactions", menu=self.showtrans)
        self.compare_menu = Menu(self.menu, tearoff=0)
        self.compare_menu.add_command(label="Compare Years",
                                      accelerator='Ctrl+J',
                                      command=self.compareyears)
        self.compare_menu.add_command(label="Compare Months",
                                      accelerator='Alt+J',
                                      command=self.comparemonths)
        self.menu.add_cascade(label="Compare", menu=self.compare_menu)
        self.about_menu = Menu(self.menu, tearoff=0)
        self.about_menu.add_command(label="About",
                                    accelerator='Ctrl+I',
                                    command=aboutmenu)
        self.menu.add_cascade(label="About", menu=self.about_menu)
        self.help_menu = Menu(self.menu, tearoff=0)
        self.help_menu.add_command(label="Help",
                                   accelerator='Ctrl+F1',
                                   command=helpmenu)
        self.menu.add_cascade(label="Help", menu=self.help_menu)

        self.master.config(menu=self.menu)

        self.master.bind('<Alt-F6>', lambda event: self.showbudget())
        self.master.bind('<Alt-i>',
                         lambda event: self.monthlytransactions('Other'))
        self.master.bind('<Alt-w>',
                         lambda event: self.monthlytransactions(None))
        self.master.bind(
            '<Alt-e>',
            lambda event: self.monthlytransactions('Transportation'))
        self.master.bind('<Control-e>',
                         lambda event: self.monthlytransactions('Grocery'))
        self.master.bind('<Control-y>',
                         lambda event: self.monthlytransactions('Bills/Taxes'))
        self.master.bind('<Alt-p>', lambda event: self.setbudget('Grocery'))
        self.master.bind('<Alt-q>', lambda event: self.setbudget('Other'))
        self.master.bind('<Control-q>',
                         lambda event: self.setbudget('Transportation'))
        self.master.bind('<Control-w>',
                         lambda event: self.setbudget('Bills/Taxes'))
        self.master.bind('<Control-t>', lambda event: self.timeseriesmonth())
        self.master.bind('<Control-s>', lambda event: self.saveas())
        self.master.bind('<Control-o>', lambda event: self.addexp())
        self.master.bind('<Alt-o>',
                         lambda event: self.monthlyexpenses('Other'))
        self.master.bind('<Alt-t>',
                         lambda event: self.monthlyexpenses('Transportation'))
        self.master.bind('<Alt-F4>', lambda event: self.exitmenu())
        self.master.bind('<Control-F1>', lambda event: helpmenu())
        self.master.bind('<Control-i>', lambda event: aboutmenu())
        self.master.bind('<Alt-s>', lambda event: self.monthlyexpenses(None))
        self.master.bind('<Alt-b>',
                         lambda event: self.monthlyexpenses('Bills/Taxes'))
        self.master.bind('<Alt-g>',
                         lambda event: self.monthlyexpenses('Grocery'))
        self.master.bind('<Control-z>', lambda event: self.clearamount())
        self.master.bind('<Alt-z>', lambda event: self.cleardes())
        self.master.bind(
            '<Control-p>',
            lambda event: self.Charts("Pie Chart of Expenses", self.categories,
                                      'pie', ['r', 'g', 'y', 'b']))
        self.master.bind(
            '<Control-b>',
            lambda event: self.Charts("Bar Chart of Expenses", self.categories,
                                      'bar', ['r', 'g', 'y', 'b']))
        self.master.bind('<Control-n>', lambda event: self.show_overview())
        self.master.bind('<Alt-n>', lambda event: self.show_expenses_info())
        #basic gui
        self.amountl = Label(self.master, text="Enter the amount")
        self.amountl.pack()
        self.textamount = Text(self.master, height=1)
        self.textamount.pack()
        self.desl = Label(self.master, text="Enter the description")
        self.desl.pack()
        self.textdes = Text(self.master, height=1)
        self.textdes.pack()
        category_list = self.categories
        self.var_cat_list = StringVar(master)
        self.var_cat_list.set(category_list[0])
        self.popupcatlistmenu = OptionMenu(self.master, self.var_cat_list,
                                           *category_list)
        self.popupcatlistmenu.pack()
        self.incomeb = Button(self.master,
                              text="Add Expense",
                              command=self.addexp)
        self.incomeb.pack()
Exemplo n.º 18
0
    def bt_projecao_click(self):
        """Click botao projecao."""
        '''def abrir_pasta():
            servidor = r'//SERVIDOR/salvar aqui/PESQUISAS'
            filetypes = (("xls files", "*.xls"), ("xlsx files", "*.xlsx"))
            root.filedialog = askopenfilename(initialdir=servidor,
                                              title="Selecione o Arquivo",
                                              filetypes=filetypes)
            ed_dist.insert(0, str(root.filedialog))'''

        def bt_projetar_click():
            dist = self.ed_dist.get().strip()
            if self.caminho:
                nome_planilha = self.caminho + '/' + \
                                     ed_nomepla.get().strip()
            else:
                nome_planilha = ed_nomepla.get().strip()
            if dist:
                if os.path.isfile(dist):  # verifica se existe arquivo
                    if ed_nomepla.get():
                        self.mensagem, *listapj = trabdados.projecao_pesquisa(
                                                     self.banco,
                                                     self.projetado,
                                                     dist, nome_planilha)
                        if listapj:
                            arquivo.grava_arquivo(self.caminho, listapj[0])
                            for l in listapj[0]:
                                tx_log.insert(INSERT, l + '\n\n')
                            self.banco = listapj[1]
                            self.lb_status['text'] = nome_planilha
                            self.bt_variaveis['state'] = 'normal'
                            bt_projetar['state'] = DISABLED
                        else:
                            msg_erro(self.mensagem)
                    else:
                        msg_erro('Digite um nome para arquivo projetado')
                else:
                    msg_erro('Nome de arquivo inexistente,\ntente outra vez'
                             ' Entre com uma Distribuição existente')
            else:
                msg_erro('Selecione ou digite arquivo distribuição')

        if self.frametl_abrirtotal:
            self.finaliza_frame()
        self.frametl_abrirtotal = Frame(self.master, bd=1, relief=FLAT)
        modelo = r'Digite nome do arquivo de distribuição igual o modelo ' \
                 r'/2018/MAIO/SÃO PAULO/DISTRIBUIÇÃO SÃO PAULO.xls'
        lb_dist = Label(self.frametl_abrirtotal, text=modelo)
        lb_dist.pack(side=TOP, padx=2, pady=1)
        frametllinha = Frame(self.frametl_abrirtotal, bd=1, relief=FLAT)
        self.ed_dist = Entry(frametllinha, width=60)
        self.ed_dist.pack(side=LEFT, padx=2, pady=1)
        img_abrir = PhotoImage(file=r'imagens\abrir-menor.png')
        bt_abrir = Button(frametllinha, image=img_abrir, relief=FLAT,
                          command=self.abrir_pasta)
        bt_abrir.image = img_abrir
        bt_abrir.pack(side=LEFT, pady=1)
        frametllinha.pack(side=TOP)
        lb_nomepla = Label(self.frametl_abrirtotal,
                           text='Nome Arquivo Projetado')
        lb_nomepla.pack()
        ed_nomepla = Entry(self.frametl_abrirtotal, width=60)
        ed_nomepla.pack()
        bt_projetar = Button(self.frametl_abrirtotal, text='PROJETAR',
                             command=bt_projetar_click)
        bt_projetar.pack()
        if int(self.banco.shape[0]) == int(self.projetado):
            bt_projetar['state'] = DISABLED
        lbespaco = Label(self.frametl_abrirtotal)
        lbespaco.pack(side=TOP, pady=20)
        frametllog = Frame(self.frametl_abrirtotal, bd=1, relief=FLAT)
        barra = Scrollbar(self.frametl_abrirtotal)
        tx_log = Text(self.frametl_abrirtotal, width=75, height=20)
        barra.pack(side=RIGHT, fill=Y)
        tx_log.pack(side=TOP)
        barra.config(command=tx_log.yview)
        tx_log.config(yscrollcommand=barra.set)
        frametllog.pack(side=TOP)
        self.frametl_abrirtotal.pack(side=TOP)
Exemplo n.º 19
0
    def __init__(self, master):
        """Create Config dialog."""
        Toplevel.__init__(self, master, class_='MyNotes')
        self.title(_("Preferences"))
        self.grab_set()
        self.protocol("WM_DELETE_WINDOW", self.quit)
        self.changes = {}, {}, False, False
        self.minsize(width=430, height=450)

        # --- style
        style = Style(self)
        style.theme_use("clam")
        style.configure("TScale", sliderlength=20)
        style.map("TCombobox",
                  fieldbackground=[('readonly', 'white')],
                  selectbackground=[('readonly', 'white')],
                  selectforeground=[('readonly', 'black')])
        style.configure("prev.TLabel", background="white")
        style.map("prev.TLabel", background=[("active", "white")])
        color = CONFIG.get("Categories",
                           CONFIG.get("General", "default_category"))
        style.configure("titlebar.TFrame", background=color)
        style.configure("titlebar.TLabel", background=color)
        style.configure("text.TFrame", background="white")

        # --- body
        self.notebook = Notebook(self)
        okcancel_frame = Frame(self)
        okcancel_frame.columnconfigure(0, weight=1)
        okcancel_frame.columnconfigure(1, weight=1)
        okcancel_frame.pack(fill="x", side='bottom')
        self.notebook.pack(expand=True, fill="both")

        # --- * General settings
        self._init_general()

        # --- * Font settings
        self._init_font()

        # --- * Categories
        self.category_settings = CategoryManager(self.notebook, master)
        self.notebook.add(self.category_settings,
                          text=_("Categories"),
                          sticky="ewsn",
                          padding=4)
        # --- * Symbols
        size = CONFIG.get("Font", "text_size")
        family = CONFIG.get("Font", "text_family")
        symbols_settings = Frame(self.notebook, padding=4)
        self.notebook.add(symbols_settings,
                          text=_("Symbols"),
                          sticky="ewsn",
                          padding=4)
        txt_frame = Frame(symbols_settings,
                          relief="sunken",
                          borderwidth=1,
                          style="text.TFrame")
        txt_frame.rowconfigure(0, weight=1)
        txt_frame.columnconfigure(0, weight=1)
        self.symbols = Text(txt_frame,
                            width=1,
                            height=1,
                            highlightthickness=0,
                            spacing2=5,
                            spacing1=5,
                            relief="flat",
                            padx=4,
                            pady=4,
                            font="%s %s" % (family.replace(" ", "\ "), size))
        scroll_y = AutoScrollbar(txt_frame,
                                 orient='vertical',
                                 command=self.symbols.yview)
        self.symbols.configure(yscrollcommand=scroll_y.set)

        self.symbols.insert("1.0", CONFIG.get("General", "symbols"))
        Label(symbols_settings, text=_("Available symbols")).pack(padx=4,
                                                                  pady=4)
        txt_frame.pack(fill="both", expand=True, padx=4, pady=4)
        self.symbols.grid(sticky='ewns')
        scroll_y.grid(row=0, column=1, sticky='ns')
        Button(symbols_settings, text=_('Reset'),
               command=self.reset_symbols).pack(padx=4, pady=4)

        # --- * AutoCorrect
        self.autocorrect_settings = AutoCorrectConfig(self.notebook, master)
        self.notebook.add(self.autocorrect_settings,
                          text=_("AutoCorrect"),
                          sticky="ewsn",
                          padding=4)

        # --- Ok/Cancel buttons
        Button(okcancel_frame, text="Ok", command=self.ok).grid(row=1,
                                                                column=0,
                                                                padx=4,
                                                                pady=10,
                                                                sticky="e")
        Button(okcancel_frame, text=_("Cancel"),
               command=self.destroy).grid(row=1,
                                          column=1,
                                          padx=4,
                                          pady=10,
                                          sticky="w")
Exemplo n.º 20
0
    def bt_variaveis_click(self):
        """Criar tela para analise e acerto de variaveis."""
        if self.frametl_abrirtotal:
            self.finaliza_frame()
        nome_planilha = self.lb_status.cget('text')

        def bt_sexo_click():
            """função para analise e acerto de sexo."""
            listavar = trabvar.arruma_variaveis_sexo(self.banco,
                                                     int(self.pesq_campo))
            arquivo.grava_arquivo(self.caminho, listavar[0])
            for l in listavar[0]:
                tx_log.insert(INSERT, l + '\n\n')
            tx_log.insert(INSERT, '\n\n')
            salvando_planilha(self.banco, nome_planilha)
            bt_sexo['state'] = DISABLED
            bt_todos['state'] = DISABLED

        def bt_idade_click():
            """função para analise e acerto de idade."""
            listavar = trabvar.arrumar_variaveis_idade(self.banco,
                                                       int(self.pesq_campo))
            arquivo.grava_arquivo(self.caminho, listavar[0])
            for l in listavar[0]:
                tx_log.insert(INSERT, l + '\n\n')
            tx_log.insert(INSERT, '\n\n')
            salvando_planilha(self.banco, nome_planilha)
            bt_idade['state'] = DISABLED
            bt_todos['state'] = DISABLED

        def bt_escolaridade_click():
            """função para analise e acerto de escolaridade."""
            listavar = trabvar.arrumar_variaveis_escolaridade(
                           self.banco, int(self.pesq_campo))
            arquivo.grava_arquivo(self.caminho, listavar[0])
            for l in listavar[0]:
                tx_log.insert(INSERT, l + '\n\n')
            tx_log.insert(INSERT, '\n\n')
            salvando_planilha(self.banco, nome_planilha)
            bt_escolaridade['state'] = DISABLED
            bt_todos['state'] = DISABLED

        def bt_religiao_click():
            """função para analise e acerto de religião."""
            listavar = trabvar.arrumar_variaveis_religiao(
                           self.banco, int(self.pesq_campo))
            arquivo.grava_arquivo(self.caminho, listavar[0])
            for l in listavar[0]:
                tx_log.insert(INSERT, l + '\n\n')
            tx_log.insert(INSERT, '\n\n')
            salvando_planilha(self.banco, nome_planilha)
            bt_religiao['state'] = DISABLED
            bt_todos['state'] = DISABLED

        def bt_todos_click():
            """função analise e acerto de todas variaveis de uma vez."""
            bt_sexo_click()
            bt_idade_click()
            bt_escolaridade_click()
            bt_religiao_click()

        self.frametl_abrirtotal = Frame(self.master, bd=1, relief=FLAT)
        frametl_left = Frame(self.frametl_abrirtotal, bd=1, relief=FLAT)
        bt_todos = Button(frametl_left, text='ARRUMAR TODOS',
                          command=bt_todos_click, width=20)
        bt_todos.pack(side=TOP, pady=20)
        bt_sexo = Button(frametl_left, text='SEXO', command=bt_sexo_click,
                         width=20)
        bt_sexo.pack(side=TOP, pady=20)
        bt_idade = Button(frametl_left, text='IDADE',
                          command=bt_idade_click, width=20)
        bt_idade.pack(side=TOP, pady=20)
        bt_escolaridade = Button(frametl_left, text='ESCOLARIDADE',
                                 command=bt_escolaridade_click, width=20)
        bt_escolaridade.pack(side=TOP, pady=20)
        bt_religiao = Button(frametl_left, text='RELIGIÃO',
                             command=bt_religiao_click, width=20)
        bt_religiao.pack(side=TOP, pady=20)
        frametl_left.pack(side=LEFT, pady=80, padx=20)
        frametl_right = Frame(self.frametl_abrirtotal, bd=1, relief=FLAT)
        barra = Scrollbar(frametl_right)
        tx_log = Text(frametl_right, width=75, height=20)
        barra.pack(side=RIGHT, fill=Y)
        tx_log.pack(side=TOP)
        barra.config(command=tx_log.yview)
        tx_log.config(yscrollcommand=barra.set)
        frametl_right.pack(side=LEFT, pady=80, padx=20)
        self.frametl_abrirtotal.pack(side=TOP)
Exemplo n.º 21
0
def ui():
    # List of possible querys, each query changes the labels for the two words
    possible_querys = [
        'Si dos palabras son herman@s', 'Si dos palabras son prim@s',
        'Si una palabra es hij@ de otra', 'Si una palabra es ti@',
        'Si son prim@s y en qué grado',
        'Si una palabra está relacionada con un idioma',
        'Palabras en un idioma originadas por una palabra específica',
        'Listar los idiomas relacionados con una palabra',
        'Contar todas las palabras comunes entre dos idiomas',
        'Listar todas las palabras comunes entre dos idiomas',
        'Idioma que más aportó a otro',
        'Listar todos los idiomas que aportaron a otro'
    ]
    # List of possible relations on knowledge database
    possible_relations = [
        'rel:derived', 'rel:etymological_origin_of', 'rel:etymologically',
        'rel:etymologically_related', 'rel:etymology', 'rel:has_derived_form',
        'rel:is_derived_from', 'rel:variant:orthography'
    ]

    # Window Properties
    window = Tk()
    window.title("Project 2 - Ethymological Relationships")
    window.geometry("1000x800+180+20")

    # Title
    Label(window, text="Ethymological Relationships",
          font="Helvetica 18 bold").place(x=337, y=50)

    # Entry DB
    Label(window, text="Database File:", font="Helvetica 14").place(x=310,
                                                                    y=130)

    input = StringVar()
    Entry(window, font="Helvetica 12", textvariable=input).place(x=445, y=132)

    # Button input database
    enter_db = Button(
        window,
        font="Helvetica 12",
        text="Enter",
        command=lambda: db_input(input, window, possible_relations)).place(
            x=640, y=125)

    # Relations
    Label(window, text="Relations:", font="Helvetica 12").place(x=30, y=200)
    relations = Listbox(window,
                        height=8,
                        font="Helvetica 12",
                        selectmode=EXTENDED,
                        exportselection=0)
    relations.place(x=30, y=220)

    for item in possible_relations:
        relations.insert(END, item)

    # Results
    Label(window, text="Results:", font="Helvetica 12").place(x=20, y=420)
    results = Text(window,
                   font="Helvetica 12",
                   height=18,
                   width=105,
                   state='disabled')
    results.place(x=20, y=440)

    # Entry
    first_entry = Label(window, text="First word:", font="Helvetica 14")
    first_entry.place(x=550, y=240)
    input_first_entry = StringVar()
    Entry(window, font="Helvetica 12",
          textvariable=input_first_entry).place(x=675, y=242)

    # Entry
    second_entry = Label(window, text="Second word:", font="Helvetica 14")
    second_entry.place(x=550, y=300)
    input_second_entry = StringVar()
    Entry(window, font="Helvetica 12",
          textvariable=input_second_entry).place(x=675, y=302)

    # Querys
    Label(window, text="Querys:", font="Helvetica 12").place(x=240, y=200)
    querys = Listbox(window,
                     height=7,
                     width=30,
                     font="Helvetica 12",
                     exportselection=0)
    querys.place(x=240, y=220)
    scrollbar = Scrollbar(window, orient="horizontal")
    scrollbar.place(x=240, y=360, width=270)
    scrollbar.config(command=querys.xview)

    querys.bind('<<ListboxSelect>>',
                lambda evt: onselect(evt, first_entry, second_entry))

    for item in possible_querys:
        querys.insert(END, item)

    # Button search
    Button(
        window,
        font="Helvetica 12",
        text="Search",
        command=lambda: search(
            input_first_entry, input_second_entry, relations, querys, results,
            window, possible_querys, possible_relations, Relations)).place(
                x=890, y=270)

    # Ejecuta la ventana
    window.mainloop()
Exemplo n.º 22
0
    def __startInput(self) -> None:
        # called setup in java
        if self.__title is not None:
            self.__root.title(self.__title)
        if self.__imagePath is not None:
            self.__root.iconphoto(True, PhotoImage(file=self.__imagePath))

        self.__root.configure(bg=self.__bgColor)
        Grid.rowconfigure(self.__root, max(self.__colRowCount), weight=1)
        Grid.columnconfigure(self.__root, 3, weight=1)
        Grid.columnconfigure(self.__root, 1, weight=1)
        Grid.columnconfigure(self.__root, 2, weight=1)

        for label in list(self.__printWindow.keys()):
            frame = Frame(self.__root)
            pw = self.__printWindow[label]
            pw['Text'] = Text(frame, wrap="word")
            pw['Scroll'] = Scrollbar(
                frame, command=pw['Text'].yview, orient="vertical")
            pw['Text'].config(state="disabled",
                              yscrollcommand=pw['Scroll'].set)
            pw['Scroll'].pack(side="right", fill="y")
            pw['Text'].pack(side="left", fill="both", expand="yes")
            frame.grid(sticky="NSEW", row=max(self.__colRowCount), column=pw['startCol'], padx=5, pady=5,
                       columnspan=(pw['endCol'] - pw['startCol'] + 1))
            Grid.rowconfigure(self.__root, max(self.__colRowCount), weight=1)
            for i in range(len(self.__colRowCount)):
                self.__colRowCount[i] += 1

        for p in self.__prompts.keys():
            self.__prompts[p]['Entry'] = Label(
                self.__root, text=self.__prompts[p]['prompt'])
            self.__prompts[p]['Entry'].grid(sticky="W" if self.__prompts[p]['alignLeft'] else 'E',
                                            row=self.__prompts[p]['row'], column=self.__prompts[p]['col'], padx=5,
                                            pady=5)

        # write out spacers in grid
        for index in range(len(self.__spacers)):
            s = self.__spacers[index]
            Label(self.__root, background=self.__bgColor).grid(
                row=s['row'], column=s['col'], padx=0, pady=5, ipady='1m')

        for sortedLabel in self.__getSortedLabels():
            label = self.__inputs[sortedLabel]
            if label['type'] == 'combo':
                label['Entry'] = Combobox(
                    self.__root, values=label['initValue'], state="readonly")
                label['Entry'].current(0)
                label['Entry'].grid(
                    sticky='EW', row=label['row'], column=label['col'], padx=5, pady=5)
            elif label['type'] == 'readstring':
                prompt = Label(self.__root, text="No file selected.")
                prompt.grid(sticky="W", row=self.__fileSelections[sortedLabel]['row'], column=2, padx=5,
                                                pady=5)
                self.__fileSelections[sortedLabel]['entry'] = prompt
            else:
                # verify command
                vcmd = (self.__root.register(self.__validateFloat), '%P') if label['type'] == 'float' else (
                    self.__root.register(self.__validateInt), '%P') if label['type'] == 'int' else None
                label['Entry'] = Entry(
                    self.__root, validate='key', validatecommand=vcmd, width=23)
                label['Entry'].grid(
                    sticky='EW', row=label['row'], column=label['col'], padx=5, pady=5)
                label['Entry'].insert(0, label['value'])

        for funcLabel in self.__functions:
            label = self.__functions[funcLabel]
            label['Button'] = Button(self.__root, takefocus=1, text=funcLabel,
                                     name=funcLabel[0].lower() + funcLabel[1:])
            label['Button'].grid(
                padx=5, pady=5, ipady='1m', sticky="NSEW", row=label['row'], column=label['col'])
            if 'function' not in label:
                label['Button'].bind("<Return>", self.__getFileName)
                label['Button'].bind("<Button-1>", self.__getFileName)
            else:
                label['Button'].bind("<Return>", self.__buttonPressed)
                label['Button'].bind("<Button-1>", self.__buttonPressed)

        # Refresh the input if the window is closed out
        self.__root.protocol("WM_DELETE_WINDOW", lambda: (
            self.__refreshInput(), self.__root.destroy()))
        self.__root.mainloop()
        try:
            self.__root.destroy()
        except TclError:
            # usually in the case of user closing the window
            pass
Exemplo n.º 23
0
    def __init__(self, master, conflict, *args):
        ttk.Frame.__init__(self, master, *args)
        self.columnconfigure(3, weight=1)
        self.rowconfigure(2, weight=1)
        self.rowconfigure(7, weight=1)

        self.conflict = conflict
        self.desiredEquilibria = 0
        self.vary = [[0, 0] for dm in self.conflict.decisionMakers]

        self.desEqLab = ttk.Label(self, text='Desired Equilibrium State')
        self.desEqLab.grid(row=0, column=0, sticky=NSEW)
        self.desEqVar = StringVar()
        self.desEqSel = ttk.Combobox(self,
                                     textvariable=self.desEqVar,
                                     state='readonly')

        self.desEqSel.grid(row=0, column=1, sticky=NSEW)
        self.desEqSel.bind('<<ComboboxSelected>>', self.setDesiredEquilibrium)

        ttk.Separator(self, orient=HORIZONTAL).grid(column=0,
                                                    row=1,
                                                    columnspan=2,
                                                    sticky=NSEW,
                                                    pady=3)

        self.varySel = VaryRangeSelector(self, self.conflict)
        self.varySel.grid(column=0, row=2, columnspan=2, sticky=NSEW)

        ttk.Separator(self, orient=HORIZONTAL).grid(column=0,
                                                    row=3,
                                                    columnspan=2,
                                                    sticky=NSEW,
                                                    pady=3)

        self.calcFrame = ttk.Frame(self)
        self.calcFrame.grid(column=0, row=4, columnspan=2, sticky=NSEW)
        self.calcFrame.columnconfigure(0, weight=1)
        self.displayPermutations = StringVar(value=0)
        self.displayPermutationsChk = ttk.Checkbutton(
            self.calcFrame,
            text="Display all Permutations",
            variable=self.displayPermutations)
        self.displayPermutationsChk.grid(column=0, row=0, sticky=NSEW)
        self.calcButton = ttk.Button(self.calcFrame,
                                     text='Perform Inverse Calculations',
                                     command=self.refreshSolution)
        self.calcButton.grid(column=1, row=1, sticky=NSEW)
        self.permCountVar = StringVar(value='InitialVal')
        self.permCount = ttk.Label(self.calcFrame,
                                   textvariable=self.permCountVar)
        self.permCount.grid(column=0, row=1, sticky=NSEW)

        ttk.Separator(self, orient=HORIZONTAL).grid(column=0,
                                                    row=5,
                                                    columnspan=2,
                                                    sticky=NSEW,
                                                    pady=3)

        self.eqmChkVals = [StringVar(value=0) for x in range(4)]

        self.eqTypeFrame = ttk.Frame(self)
        self.eqTypeFrame.grid(column=0, row=6, columnspan=2, sticky=NSEW)
        ttk.Label(self.eqTypeFrame,
                  text='Show only rankings that satisfy all '
                  'the following equilibrium concepts:').grid(column=0,
                                                              row=0,
                                                              columnspan=4,
                                                              sticky=NSEW)
        self.nashChk = ttk.Checkbutton(self.eqTypeFrame,
                                       text='Nash',
                                       command=self.filter,
                                       variable=self.eqmChkVals[0])
        self.seqChk = ttk.Checkbutton(self.eqTypeFrame,
                                      text='SEQ',
                                      command=self.filter,
                                      variable=self.eqmChkVals[1])
        self.gmrChk = ttk.Checkbutton(self.eqTypeFrame,
                                      text='GMR',
                                      command=self.filter,
                                      variable=self.eqmChkVals[2])
        self.smrChk = ttk.Checkbutton(self.eqTypeFrame,
                                      text='SMR',
                                      command=self.filter,
                                      variable=self.eqmChkVals[3])
        self.nashChk.grid(column=0, row=1, sticky=NSEW, padx=(5, 10))
        self.seqChk.grid(column=1, row=1, sticky=NSEW, padx=(5, 10))
        self.gmrChk.grid(column=2, row=1, sticky=NSEW, padx=(5, 10))
        self.smrChk.grid(column=3, row=1, sticky=NSEW, padx=(5, 10))
        self.nashCountVar = StringVar(value='IV')
        self.seqCountVar = StringVar(value='IV')
        self.gmrCountVar = StringVar(value='IV')
        self.smrCountVar = StringVar(value='IV')
        self.nashCount = ttk.Label(self.eqTypeFrame,
                                   textvariable=self.nashCountVar).grid(
                                       column=0, row=2, sticky=NSEW)
        self.seqCount = ttk.Label(self.eqTypeFrame,
                                  textvariable=self.seqCountVar).grid(
                                      column=1, row=2, sticky=NSEW)
        self.gmrCount = ttk.Label(self.eqTypeFrame,
                                  textvariable=self.gmrCountVar).grid(
                                      column=2, row=2, sticky=NSEW)
        self.smrCount = ttk.Label(self.eqTypeFrame,
                                  textvariable=self.smrCountVar).grid(
                                      column=3, row=2, sticky=NSEW)

        ttk.Separator(self, orient=VERTICAL).grid(column=2,
                                                  row=0,
                                                  rowspan=10,
                                                  sticky=NSEW,
                                                  padx=3)

        self.conditionDisp = Text(self)
        self.conditionDisp.configure(wrap="word")
        self.conditionDisp.configure(state="disabled")
        self.conditionDisp.grid(column=3, row=0, rowspan=7, sticky=NSEW)

        self.conditionDispScrl = ttk.Scrollbar(
            self, orient=VERTICAL, command=self.conditionDisp.yview)
        self.conditionDisp.configure(yscrollcommand=self.conditionDispScrl.set)
        self.conditionDispScrl.grid(column=4, row=0, rowspan=7, sticky=NSEW)

        self.resDisp = ttk.Treeview(self, selectmode='browse')

        self.resDisp.grid(column=3, row=7, rowspan=3, sticky=NSEW)

        self.resDispScrl = ttk.Scrollbar(self,
                                         orient=VERTICAL,
                                         command=self.resDisp.yview)
        self.resDisp.configure(yscrollcommand=self.resDispScrl.set)
        self.resDispScrl.grid(column=4, row=7, rowspan=3, sticky=NSEW)

        self.varySel.chgVary()

        # ###########

        self.refreshSolution()
Exemplo n.º 24
0
 def __init__(self, name, *args, **kwargs):
     Frame.__init__(self, *args, **kwargs)
     self.TextTraining = Text(self)
     path_asli = '..\\Data Lagu\\asli\\reff'
     self.filepath_asli = [
         os.path.join(path_asli, fname) for fname in os.listdir(path_asli)
         if fname.endswith('.wav')
     ]
     self.idx_tests = {
         '01': 0,
         '02': 1,
         '03': 2,
         '04': 3,
         '05': 4,
         '06': 5,
         '07': 6,
         '08': 7,
         '09': 8,
         '10': 9
     }
     lblTop = Label(self, text="Pengujian Data Uji")
     lblTop.grid(row=0, column=0)
     lblFbank = Label(self, text="Filter Bank")
     lblFbank.grid(row=1, column=0, padx=5, pady=10, sticky="E")
     self.fbank = StringVar(value="20")
     entFbank = Entry(self, textvariable=self.fbank)
     entFbank.grid(row=1, column=1, sticky="W", pady=10)
     lblWinlen = Label(self, text="WinLen")
     lblWinlen.grid(row=1, column=2, sticky="E")
     self.winlen = StringVar(value="0.05")
     entWinlen = Entry(self, textvariable=self.winlen)
     entWinlen.grid(row=1, column=3, sticky="W", pady=10)
     lblWinstep = Label(self, text="WinStep")
     lblWinstep.grid(row=1, column=4, sticky="E")
     self.winstep = StringVar(value="0.025")
     entWinstep = Entry(self, textvariable=self.winstep)
     entWinstep.grid(row=1, column=5, sticky="W", pady=10)
     btnUji = Button(self, text="Uji", command=self.testing)
     btnUji.grid(row=2, column=3)
     btnReset = Button(self, text="Reset", command=self.reset)
     btnReset.grid(row=2, column=5)
     lblHasil = Label(self, text="Hasil Pengujian")
     lblHasil.grid(row=3, column=0)
     self.frmTabelHasil = Frame(self)
     self.frmTabelHasil.grid(row=4, column=0, columnspan=6)
     self.scrollFrame = ScrollFrame(self.frmTabelHasil)
     self.scrollFrame.pack(side="top", fill="both", expand=True)
     lblLaguAsli = Label(self.scrollFrame.viewPort,
                         text="Lagu Asli",
                         width="20")
     lblLaguAsli.grid(row=0, column=0)
     lblBatasTabel = Label(self.scrollFrame.viewPort, text="|")
     lblBatasTabel.grid(row=0, column=1)
     lblHasilUji = Label(self.scrollFrame.viewPort,
                         text="Hasil",
                         width="20")
     lblHasilUji.grid(row=0, column=2)
     lblAkurasi = Label(self, text="Akurasi")
     lblAkurasi.grid(row=5, column=0, padx=10, pady=10)
     lblEqual = Label(self, text="=")
     lblEqual.grid(row=5, column=1)
     self.akurasi = StringVar(value="")
     entAkurasi = Entry(self, textvariable=self.akurasi)
     entAkurasi.grid(row=5, column=2)
Exemplo n.º 25
0
 def setUpClass(cls):
     requires('gui')
     cls.root = Tk()
     cls.root.withdraw()
     cls.text = Text(cls.root)
Exemplo n.º 26
0
 def __init__(self, name, *args, **kwargs):
     Frame.__init__(self, *args, **kwargs)
     self.TextData = Text(self)
     self.LabelData = Label(self)
     path_asli = '..\\Data Lagu\\asli\\reff'
     self.filepath_asli = [
         os.path.join(path_asli, fname) for fname in os.listdir(path_asli)
         if fname.endswith('.wav')
     ]
     self.idx_tests = {
         '01': 0,
         '02': 1,
         '03': 2,
         '04': 3,
         '05': 4,
         '06': 5,
         '07': 6,
         '08': 7,
         '09': 8,
         '10': 9
     }
     lblInputLagu = Label(self, text="Input Lagu")
     lblInputLagu.grid(row=0, column=0)
     lblLagu = Label(self, text="Lagu")
     lblLagu.grid(row=1, column=0)
     self.lblFilepath = Label(self,
                              text="...",
                              width="40",
                              background="white")
     self.lblFilepath.grid(row=1,
                           column=1,
                           pady=10,
                           columnspan=3,
                           sticky="W")
     self.BtnBrowse = Button(self, text="Pilih", command=self.fileDialog)
     self.BtnBrowse.grid(row=1, column=4, pady=10, padx=10, sticky="E")
     self.btnReset = Button(self, text="Reset", command=self.reset)
     self.btnReset.grid(row=1, column=5)
     lblFbank = Label(self, text="Filter Bank")
     lblFbank.grid(row=2, column=0, padx=5, pady=10, sticky="E")
     self.fbank = StringVar(value="20")
     entFbank = Entry(self, textvariable=self.fbank)
     entFbank.grid(row=2, column=1, sticky="W", pady=10)
     lblWinlen = Label(self, text="WinLen")
     lblWinlen.grid(row=2, column=2, sticky="E")
     self.winlen = StringVar(value="0.05")
     entWinlen = Entry(self, textvariable=self.winlen)
     entWinlen.grid(row=2, column=3, sticky="W", pady=10)
     lblWinstep = Label(self, text="WinStep")
     lblWinstep.grid(row=2, column=4, sticky="E")
     self.winstep = StringVar(value="0.025")
     entWinstep = Entry(self, textvariable=self.winstep)
     entWinstep.grid(row=2, column=5, sticky="W", pady=10)
     self.BtnIdentifying = Button(self,
                                  text="Identifikasi",
                                  pady=5,
                                  padx=10,
                                  command=self.identifikasi)
     self.BtnIdentifying.grid(row=3,
                              column=0,
                              columnspan=4,
                              pady=10,
                              padx=10,
                              sticky="E")
     lblIdentLagu = Label(self, text="Identifikasi Lagu")
     lblIdentLagu.grid(row=4, column=0, padx=5)
     lblHasil = Label(self, text="Hasil")
     lblHasil.grid(row=5, column=0)
     self.hCover = StringVar(value="")
     entHasilCover = Entry(self, textvariable=self.hCover)
     entHasilCover.grid(row=5, column=1, sticky="E")
     lblEqual = Label(self, text="=")
     lblEqual.grid(row=5, column=2)
     self.hAsli = StringVar(value="")
     entHasilAsli = Entry(self, textvariable=self.hAsli)
     entHasilAsli.grid(row=5, column=3)
     self.kesimpulan = StringVar(value="")
     entKesimpulan = Entry(self, textvariable=self.kesimpulan)
     entKesimpulan.grid(row=6, column=0, padx=10, pady=5)
Exemplo n.º 27
0
 def setUpClass(cls):
     cls.root = Tk()
     cls.root.withdraw()
     cls.text = Text(cls.root)
     cls.editwin = DummyEditwin(cls.text)
     cls.editwin.text_frame = Mock()
Exemplo n.º 28
0
window.geometry('1000x1000')

window.configure(background="gray")

bg_image = PhotoImage(file="indexxx.png")
x = Label(image=bg_image, borderwidth=0)

x.place(x=10, y=10)

lbl = Label(window, text="Add group :", background="gray", foreground="white")
lbl.config(width=200)
lbl.config(font='Helvetica  20 bold')
lbl.place(x=250, y=300)

t = Text(window, height=2, width=40, background="white")
t.place(x=440, y=310)


def addGroup():
    fileName = t.get('1.0', END)
    filepath = os.path.join("file_directory", fileName)
    if os.path.isfile(filepath) == True:
        messagebox.showwarning('Warning', 'File exists')
        exit

    f = open(filepath, "a")

    f.close

Exemplo n.º 29
0
 filemenu = Menu(mainwindow)
 filemenu.add_command(label="Restart Program", command=restart)
 
 #recache button
 filemenu.add_command(label="Recache Storylist", command=lambda:recache(consolelog))
 
 #view downloaded library
 filemenu.add_command(label="View Downloaded", command=lambda:openlib(mainwindow))
 
 #check for updates
 filemenu.add_command(label="Update", command=updater.main)
 
 mainwindow.config(menu=filemenu)
 
 #show console log
 consolelog = Text(mainwindow)
 consolelog.pack()
 #get forum name
 forum = Entry(mainwindow, width=60)
 forum.insert(END, 'Forum Name (EX: sdm)')
 forum.pack(side=BOTTOM)
 
 #get thread ids (title search coming soon)
 story = Entry(mainwindow, width=60)
 story.insert(END, 'Thread IDs (EX: 142 255 2736)')
 story.pack(side=BOTTOM)
 
 #searchbar
 searchbar = Entry(mainwindow, width=60)
 searchbar.insert(END, 'Search title or author')
 searchbar.pack()
Exemplo n.º 30
0
# import
import tkinter as tk
from tkinter import Text

# ana pencere
window = tk.Tk()
window.title('Tkinter Temelleri - Text')
window.geometry('600x400')

# Text Widget  (Text Area)
txt = Text(window, height=2, width=40)

# yerleştir
txt.pack()

# mainloop
window.mainloop()