Python tkinter.NORMAL Examples
The following are 30
code examples of tkinter.NORMAL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.
Example #1
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 7 votes |
def on_modified(self, event=None): if not hasattr(self, "modifiedLabel"): self.editor.edit_modified(False) return if self.editor.edit_modified(): text, mac, state = "MOD", True, tk.NORMAL else: text, mac, state = "", False, tk.DISABLED self.modifiedLabel.config(text=text) if TkUtil.mac(): self.master.attributes("-modified", mac) self.fileMenu.entryconfigure(SAVE, state=state) self.fileMenu.entryconfigure(SAVE_AS + ELLIPSIS, state=state) self.saveButton.config(state=state) self.editMenu.entryconfigure(UNDO, state=state) self.undoButton.config(state=state)
Example #2
Source File: pynpuzzle.py From pynpuzzle with MIT License | 6 votes |
def config_frame_state(frame, state): """ Changes the status property of a frame children. """ for child in frame.winfo_children(): # Only output_play_button can change output_stop_button's state if child is output_stop_button: # If output is playing right now if play_event: # Someone wants to disable the output frame, so output play must stop play_event.set() continue child['state'] = state # output_0_label's and output_to_label's cursor property are depending on their frame status if frame is output_action_frame: cursor = 'arrow' if state == tkinter.NORMAL: cursor = 'fleur' output_0_label['cursor'] = cursor output_to_label['cursor'] = cursor
Example #3
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def update_recent_files_menu(self): if self.recentFiles: menu = tk.Menu(self.fileMenu) i = 1 for filename in self.recentFiles: if filename != self.editor.filename: menu.add_command(label="{}. {}".format(i, filename), underline=0, command=lambda filename=filename: self.load(filename)) i += 1 self.fileMenu.entryconfigure(OPEN_RECENT, menu=menu) self.fileMenu.entryconfigure(OPEN_RECENT, state=tk.NORMAL if i > 1 else tk.DISABLED) else: self.fileMenu.entryconfigure(OPEN_RECENT, state=tk.DISABLED)
Example #4
Source File: pynpuzzle.py From pynpuzzle with MIT License | 6 votes |
def calculation_stop(): """ Does some routine works that has to be done when to stop calculation. """ # Show start button start_button.grid() start_button_border_frame.grid() # Hide progress bar progress_bar.grid_remove() progress_bar.stop() stop_button['state'] = tkinter.DISABLED # Re-enable menu bar buttons menu_bar.entryconfig('Reload algorithms', state=tkinter.NORMAL) menu_bar.entryconfig('Change goal state', state=tkinter.NORMAL) n_spinbox['state'] = tkinter.NORMAL # Enable input data entry config_io_frame_state(input_labelframe, tkinter.NORMAL)
Example #5
Source File: gui_mgr.py From plex-mpv-shim with MIT License | 6 votes |
def update(self): try: self.text.config(state=tk.NORMAL) while True: action, param = self.queue.get_nowait() if action == "append": self.text.config(state=tk.NORMAL) self.text.insert(tk.END, "\n") self.text.insert(tk.END, param) self.text.config(state=tk.DISABLED) self.text.see(tk.END) elif action == "die": self.root.destroy() self.root.quit() return except queue.Empty: pass self.text.after(100, self.update)
Example #6
Source File: Controlador.py From proyectoDownloader with MIT License | 6 votes |
def cargarPlayList(self): self.vista.notebook.select(self.vista.tabPL) self.disponibles = self.recursoPL['items'] self.vista.listPL.delete(0, END) i = 0 texto_a_insertar = "{}) Título: {}, Duración: {}" for s in self.disponibles: i += 1 insertar = texto_a_insertar.format(i, s['pafy'].title[:40]+"...", s['pafy'].duration) try: self.vista.listPL.insert(END,insertar) except TclError as e: pass self.vista.button.config(state=NORMAL) self.vista.bvideo.config(state=NORMAL) self.vista.baudio.config(state=NORMAL) self.vista.bborrar.config(state=NORMAL) self.vista.config(cursor="")
Example #7
Source File: table_gui.py From pyDEA with MIT License | 6 votes |
def change_state_if_needed(self, entry, entry_state, row, col): ''' Changes state of Checkbutton when data was modified depending on the state of main_box. Args: entry (SelfValidatingEntry): Entry widget whose content was modified. entry_state (int): state of the Entry widget after content modification, for possible values see dea_utils module. row (int): row index of entry widget. It is the real grid value, we need to subtract 2 to get internal index. col (int): column index of entry widget. It is the real grid value, we need to subtract 2 to get internal index. ''' category_name = self.get_category() if str(self.main_box.cget('state')) == DISABLED: self.disable(col - 2, category_name) else: self.config(state=NORMAL) if entry_state != CELL_DESTROY and self.var.get() == 1: self.category_frame.add_category(category_name)
Example #8
Source File: app.py From captcha_trainer with Apache License 2.0 | 6 votes |
def training_task(self): model_conf = ModelConfig(project_name=self.current_project) self.current_task = Trains(model_conf) try: self.button_state(self.btn_training, tk.DISABLED) self.button_state(self.btn_stop, tk.NORMAL) self.is_task_running = True self.current_task.train_process() status = 'Training completed' except Exception as e: traceback.print_exc() messagebox.showerror( e.__class__.__name__, json.dumps(e.args, ensure_ascii=False) ) status = 'Training failure' self.button_state(self.btn_training, tk.NORMAL) self.button_state(self.btn_stop, tk.DISABLED) self.comb_project_name['state'] = tk.NORMAL self.is_task_running = False tk.messagebox.showinfo('Training Status', status)
Example #9
Source File: annotation_gui.py From SEM with MIT License | 6 votes |
def load_pipeline(self, event=None): top = tkinter.Toplevel() master_selector = SemTkMasterSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources")) lang_selector = SemTkLangSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources")) lang_selector.master_selector = master_selector vars_cur_row = 0 vars_cur_row, _ = lang_selector.grid(row=vars_cur_row, column=0) vars_cur_row, _ = master_selector.grid(row=vars_cur_row, column=0) def cancel(event=None): if self.pipeline is not None: self.tag_document_btn.configure(state=tkinter.NORMAL) top.destroy() def ok(event=None): path = master_selector.workflow() pipeline, _, _, _ = sem.modules.tagger.load_master(path) self.pipeline = pipeline cancel() ok_btn = ttk.Button(top, text="load workflow", command=ok) ok_btn.grid(row=vars_cur_row, column=0) cancel_btn = ttk.Button(top, text="cancel", command=cancel) cancel_btn.grid(row=vars_cur_row, column=1)
Example #10
Source File: gui.py From videodownloader with MIT License | 6 votes |
def threaded_check_video(self): self.last_row = 0 self.stream.set(0) [radio_button.destroy() for radio_button in self.stream_widgets] url = self.text_url.get() if 'https' not in url: url = 'https://www.youtube.com/watch?v=%s' % url try: if self.proxy.get() != '': self.video = YouTube(url, proxies={self.proxy.get().split(':')[0]: self.proxy.get()}) else: self.video = YouTube(url) self.label_video_title['text'] = self.video.title self.streams = self.video.streams.filter(only_audio=self.audio_only.get()).all() for stream in self.streams: if self.audio_only.get(): text = f'Codec: {stream.audio_codec}, ' \ f'ABR: {stream.abr} ' \ f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB' else: if stream.video_codec is None: continue text = f'Res: {stream.resolution}, FPS: {stream.fps},' \ f' Video Codec: {stream.video_codec}, Audio Codec: {stream.audio_codec}, ' \ f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB' radio_button = tk.Radiobutton(self.frame, text=text, variable=self.stream, value=stream.itag) self.last_row += 1 radio_button.grid(row=self.last_row, column=0, columnspan=4) self.stream_widgets.append(radio_button) except PytubeError as e: messagebox.showerror('Something went wrong...', e) except RegexMatchError as e: messagebox.showerror('Something went wrong...', e) finally: self.btn_check_id['text'] = 'Check Video' self.btn_check_id.config(state=tk.NORMAL)
Example #11
Source File: options_frame_gui.py From pyDEA with MIT License | 6 votes |
def radio_btn_change(self, name, *args): ''' Actions that happen when user clicks on a Radiobutton. Changes the corresponding parameter values and options. Args: name (str): name of the parameter that is a key in options dictionary. *args: are provided by IntVar trace method and are ignored in this method. ''' count = self.options[name].get() self.params.update_parameter(name, COUNT_TO_NAME_RADIO_BTN[name, count]) dea_form = COUNT_TO_NAME_RADIO_BTN[name, count] if self.max_slack_box: # on creation it is None if dea_form == 'multi': # disable max slacks self.max_slack_box.config(state=DISABLED) self.params.update_parameter('MAXIMIZE_SLACKS', '') elif dea_form == 'env': self.max_slack_box.config(state=NORMAL) if self.options['MAXIMIZE_SLACKS'].get() == 1: self.params.update_parameter('MAXIMIZE_SLACKS', 'yes')
Example #12
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def update_recent_files_menu(self): if self.recentFiles: menu = tk.Menu(self.fileMenu) i = 1 for filename in self.recentFiles: if filename != self.editor.filename: menu.add_command(label="{}. {}".format(i, filename), underline=0, command=lambda filename=filename: self.load(filename)) i += 1 self.fileMenu.entryconfigure(OPEN_RECENT, menu=menu) self.fileMenu.entryconfigure(OPEN_RECENT, state=tk.NORMAL if i > 1 else tk.DISABLED) else: self.fileMenu.entryconfigure(OPEN_RECENT, state=tk.DISABLED)
Example #13
Source File: menu_display.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, category, **kwargs): super().__init__(parent, **kwargs) self.category = category self.price_input = lib.PriceInput(self, font=self.font, width=7, conditional_bind=False) self.price_input.configure(state=tk.NORMAL) self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(1, weight=1) self.button = lib.MessageButton(self, text="Open Charge", anchor=tk.W, font=self.font, relief=tk.RAISED, bd=2) self.button.command = self.add_item self.button.grid(row=0, column=0, sticky="nswe") self.price_input.grid(row=0, column=1, sticky="nswe")
Example #14
Source File: app.py From captcha_trainer with Apache License 2.0 | 5 votes |
def comb_category_callback(self, event): comb_selected = self.comb_category.get() if comb_selected == 'CUSTOMIZED': self.category_entry['state'] = tk.NORMAL else: self.category_entry.delete(0, tk.END) self.category_entry['state'] = tk.DISABLED
Example #15
Source File: ULAIO01.py From mcculw with MIT License | 5 votes |
def set_input_ui_idle_state(self): self.input_high_channel_entry["state"] = tk.NORMAL self.input_low_channel_entry["state"] = tk.NORMAL self.input_start_button["command"] = self.start_input self.input_start_button["text"] = "Start Analog Input"
Example #16
Source File: ULAI06.py From mcculw with MIT License | 5 votes |
def set_ui_idle_state(self): self.high_channel_entry["state"] = tk.NORMAL self.low_channel_entry["state"] = tk.NORMAL self.start_button["command"] = self.start self.start_button["text"] = "Start"
Example #17
Source File: tkgui.py From ATX with Apache License 2.0 | 5 votes |
def _run_selectfile(self): filename = tkFileDialog.askopenfilename(**dict( filetypes=[('All files', '.*'), ('Python', '.py')], title='Select file')) self._attachfile_text.set(filename) if filename: self._btn_runedit.config(state=tk.NORMAL) print(filename)
Example #18
Source File: log_window.py From clai with MIT License | 5 votes |
def add_log_data(self, chunk): self.text_gui.configure(state=tk.NORMAL) self.text_gui.insert("end", chunk) if self.autoscroll_enable.get() == 1: self.text_gui.see("end") self.text_gui.configure(state=tk.DISABLED)
Example #19
Source File: box.py From synthesizer with GNU Lesser General Public License v3.0 | 5 votes |
def set_effect(self, effect_nr, filename): try: with AudiofileToWavStream(filename, hqresample=hqresample) as wav: sample = Sample(wav) self.effects[effect_nr] = sample except IOError as x: print("Can't load effect sample:", x) else: for button in self.buttons: if button.effect_nr == effect_nr: button["state"] = tk.NORMAL button["text"] = os.path.splitext(os.path.basename(filename))[0] break
Example #20
Source File: app.py From captcha_trainer with Apache License 2.0 | 5 votes |
def make_dataset(self): if not self.current_project: messagebox.showerror( "Error!", "Please set the project name first." ) return if self.is_task_running: messagebox.showerror( "Error!", "Please terminate the current training first or wait for the training to end." ) return self.save_conf() self.button_state(self.btn_make_dataset, tk.DISABLED) model_conf = ModelConfig(self.current_project) train_path = self.dataset_value(DatasetType.Directory, RunMode.Trains) validation_path = self.dataset_value(DatasetType.Directory, RunMode.Validation) if len(train_path) < 1: messagebox.showerror( "Error!", "{} Sample set has not been added.".format(RunMode.Trains.value) ) self.button_state(self.btn_make_dataset, tk.NORMAL) return self.threading_exec( lambda: DataSets(model_conf).make_dataset( trains_path=train_path, validation_path=validation_path, is_add=False, callback=lambda: self.button_state(self.btn_make_dataset, tk.NORMAL), msg=lambda x: tk.messagebox.showinfo('Make Dataset Status', x) ) )
Example #21
Source File: tkgui.py From ATX with Apache License 2.0 | 5 votes |
def _run_check_refresh(self): auto = self._auto_refresh_var.get() state = tk.DISABLED if auto else tk.NORMAL self._btn_refresh.config(state=state)
Example #22
Source File: Controlador.py From proyectoDownloader with MIT License | 5 votes |
def __descargarVideo(self): """ Método que descarga el video seleccionado y muestra la carga """ self.d = True try: file = self.seleccion.download( quiet=True, filepath=self.vista.path.get(), callback=self.callback) except Exception as e: raise e msg.showerror("Error", "El archivo ya existe.") self.top.destroy() self.d = False msg.showinfo("Mensaje", "Archivo descargado correctamente") self.vista.text.config(state=NORMAL) self.vista.text.delete(1.0, END) self.vista.text.config(state=DISABLED) self.vista.listbox.delete(0, END) self.vista.url.set("") self.vista.imagen.config(text="No disponible", image='') self.vista.imagen.image = '' self.vista.button.config(state=NORMAL) self.vista.bvideo.config(state=NORMAL) self.vista.baudio.config(state=NORMAL) self.vista.config(cursor='') self.vista.bborrar.config(state=NORMAL) self.vista.config(cursor="")
Example #23
Source File: ULAIO01.py From mcculw with MIT License | 5 votes |
def set_output_ui_idle_state(self): self.output_high_channel_entry["state"] = tk.NORMAL self.output_low_channel_entry["state"] = tk.NORMAL self.output_start_button["command"] = self.start_output self.output_start_button["text"] = "Start Analog Output"
Example #24
Source File: ULAO04.py From mcculw with MIT License | 5 votes |
def set_ui_idle_state(self): self.high_channel_entry["state"] = tk.NORMAL self.low_channel_entry["state"] = tk.NORMAL self.start_button["command"] = self.start self.start_button["text"] = "Start"
Example #25
Source File: ULTI02.py From mcculw with MIT License | 5 votes |
def stop(self): self.running = False self.start_button["command"] = self.start self.start_button["text"] = "Start" self.low_channel_entry["state"] = tk.NORMAL self.high_channel_entry["state"] = tk.NORMAL
Example #26
Source File: ULAO02.py From mcculw with MIT License | 5 votes |
def send_data(self): # Build the data array num_chans = min(self.ao_props.num_chans, 4) num_points = num_chans ao_range = self.ao_props.available_ranges[0] memhandle = ul.win_buf_alloc(num_points) # Check if the buffer was successfully allocated if not memhandle: messagebox.showerror("Error", "Failed to allocate memory") self.start_button["state"] = tk.NORMAL return try: data_array = self.memhandle_as_ctypes_array(memhandle) full_scale_count = (2 ** self.ao_props.resolution) - 1 value_step = full_scale_count / (num_chans + 1) for point_num in range(0, num_points): raw_value = int(value_step * (point_num + 1)) data_array[point_num] = raw_value self.raw_data_labels[point_num]["text"] = str(raw_value) # ul.to_eng_units cannot be used here, as it uses the analog # input resolution. Instead, do the conversion on our own. volts = self.ao_to_eng_units( raw_value, ao_range, self.ao_props.resolution) self.volts_labels[point_num]["text"] = ( '{:.3f}'.format(volts)) ul.a_out_scan( self.board_num, 0, num_chans - 1, num_points, 100, ao_range, memhandle, 0) except ULError as e: self.show_ul_error(e) finally: ul.win_buf_free(memhandle)
Example #27
Source File: GUI.py From message-analyser with MIT License | 5 votes |
def emit(self, message): # Overwrites the default handler's emit method formatted_message = self.format(message) # You can change the format here # Disabling states so no user can write in it self.console.configure(state=tk.NORMAL) self.console.insert(tk.END, formatted_message) # Inserting the logger message in the widget self.console.configure(state=tk.DISABLED) self.console.see(tk.END) # print(message) # You can just print to STDout in your overriden emit no need for black magic
Example #28
Source File: gui.py From videodownloader with MIT License | 5 votes |
def threaded_download(self): try: if self.proxy.get() != '': proxy = {self.proxy.get().split(':')[0]: self.proxy.get()} else: proxy = None for search_stream in self.streams: if int(search_stream.itag) == int(self.stream.get()): self.file_size = search_stream.filesize break filename = download_youtube_video(self.text_url.get(), itag=self.stream.get(), output_path=self.output_path.get(), filename=self.filename_override.get() if self.filename_override.get() != '' else None, proxies=proxy, progress_callback=self.update_progress_bar) messagebox.showinfo('Download Complete!', 'Download Complete!\n%s' % filename) except PytubeError as e: messagebox.showerror('Something went wrong...', e) except RegexMatchError as e: messagebox.showerror('Something went wrong...', e) except Exception as e: messagebox.showerror('Something went wrong', 'Something unknown went wrong. Is this a live stream? Wait until the stream ends.' '\n\n%s' % e) finally: self.btn_download['text'] = 'Download' self.btn_download.config(state=tk.NORMAL) self.btn_check_id.config(state=tk.NORMAL) self.btn_output_browse.config(state=tk.NORMAL) [radio_button.config(state=tk.NORMAL) for radio_button in self.radio_video_audio]
Example #29
Source File: Controlador.py From proyectoDownloader with MIT License | 5 votes |
def __descargaAudio(self): """ Método que descarga el video seleccionado y muestra la carga """ self.bestaudio = self.recurso.getbestaudio(preftype='m4a') if self.bestaudio != None: self.d = True self.fileaudio = self.bestaudio.title+".m4a" self.size = self.bestaudio.get_filesize() try: self.bestaudio.download( quiet=True, callback=self.callback, filepath=self.vista.path.get()) msg.showinfo("Mensaje", "Archivo descargado correctamente.") except Exception as e: msg.showerror("Error", "El archivo ya existe.") self.top.destroy() self.d = False self.vista.text.config(state=NORMAL) self.vista.text.delete(1.0, END) self.vista.text.config(state=DISABLED) self.vista.listbox.delete(0, END) self.vista.url.set("") self.vista.imagen.config(text="No disponible", image='') self.vista.imagen.image = '' self.vista.button.config(state=NORMAL) self.vista.bvideo.config(state=NORMAL) self.vista.baudio.config(state=NORMAL) self.vista.config(cursor='') self.vista.bborrar.config(state=NORMAL) self.vista.config(cursor="")
Example #30
Source File: gui.py From Telethon with MIT License | 5 votes |
def set_signed_in(self, me): """ Configures the application as "signed in" (displays user's name and disables the entry to input phone/bot token/code). """ self.me = me self.sign_in_label.configure(text='Signed in') self.sign_in_entry.configure(state=tkinter.NORMAL) self.sign_in_entry.delete(0, tkinter.END) self.sign_in_entry.insert(tkinter.INSERT, utils.get_display_name(me)) self.sign_in_entry.configure(state=tkinter.DISABLED) self.sign_in_button.configure(text='Log out') self.chat.focus() # noinspection PyUnusedLocal