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: 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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
Source File: gui.py From Telethon with MIT License | 5 votes |
def sign_in(self, event=None): """ Note the `event` argument. This is required since this callback may be called from a ``widget.bind`` (such as ``'<Return>'``), which sends information about the event we don't care about. This callback logs out if authorized, signs in if a code was sent or a bot token is input, or sends the code otherwise. """ self.sign_in_label.configure(text='Working...') self.sign_in_entry.configure(state=tkinter.DISABLED) if await self.cl.is_user_authorized(): await self.cl.log_out() self.destroy() return value = self.sign_in_entry.get().strip() if self.code: self.set_signed_in(await self.cl.sign_in(code=value)) elif ':' in value: self.set_signed_in(await self.cl.sign_in(bot_token=value)) else: self.code = await self.cl.send_code_request(value) self.sign_in_label.configure(text='Code:') self.sign_in_entry.configure(state=tkinter.NORMAL) self.sign_in_entry.delete(0, tkinter.END) self.sign_in_entry.focus() return
Example #15
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
Example #16
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def update_logs_text_if_visible(): """ If show logs window is open, then update the text widget's content. If someone updates app logs, then should invoke this function. """ if logs_text: logs_text['state'] = tkinter.NORMAL logs_text.delete(0.0, tkinter.END) logs_text.insert(0.0, ''.join(LOGS)) logs_text['state'] = tkinter.DISABLED # Scroll to end of text logs_text.see(tkinter.END)
Example #17
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def output_stop_button_cmd(): """ Output's stop button click handler Stops playing the output. """ play_event.set() output_play_button['state'] = tkinter.NORMAL output_stop_button['state'] = tkinter.DISABLED # Output's stop button widget
Example #18
Source File: mainWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 5 votes |
def showClearMenuOption(self, show, command): if show: self.mainMenu.menu.entryconfig(3, state=tk.NORMAL, command=command) else: self.mainMenu.menu.entryconfig(3, state=tk.DISABLED)
Example #19
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def on_selection(self, event=None): state = (tk.NORMAL if self.editor.text.tag_ranges(tk.SEL) else tk.DISABLED) self.editMenu.entryconfigure(COPY, state=state) self.copyButton.config(state=state) self.editMenu.entryconfigure(CUT, state=state) self.cutButton.config(state=state)
Example #20
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def on_moved(self, event=None): state = tk.NORMAL if not self.editor.is_empty() else tk.DISABLED self.editMenu.entryconfigure(FIND + ELLIPSIS, state=state) self.findButton.config(state=state) lineCol = self.editor.index(tk.INSERT).split(".") self.positionLabel.config(text="↓{}→{}".format(lineCol[0], lineCol[1]))
Example #21
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def create_font(self): weight = tkfont.BOLD if int(self.bold.get()) else tkfont.NORMAL slant = tkfont.ITALIC if int(self.italic.get()) else tkfont.ROMAN return tkfont.Font(family=self.fontFamily.get(), size=self.fontPointSize.get(), weight=weight, slant=slant)
Example #22
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def on_selection(self, event=None): state = (tk.NORMAL if self.editor.text.tag_ranges(tk.SEL) else tk.DISABLED) self.editMenu.entryconfigure(COPY, state=state) self.copyButton.config(state=state) self.editMenu.entryconfigure(CUT, state=state) self.cutButton.config(state=state)
Example #23
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def on_moved(self, event=None): state = tk.NORMAL if not self.editor.is_empty() else tk.DISABLED self.editMenu.entryconfigure(FIND + ELLIPSIS, state=state) self.findButton.config(state=state) lineCol = self.editor.index(tk.INSERT).split(".") self.positionLabel.config(text="↓{}→{}".format(lineCol[0], lineCol[1]))
Example #24
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def create_font(self): weight = tkfont.BOLD if int(self.bold.get()) else tkfont.NORMAL slant = tkfont.ITALIC if int(self.italic.get()) else tkfont.ROMAN return tkfont.Font(family=self.fontFamily.get(), size=self.fontPointSize.get(), weight=weight, slant=slant)
Example #25
Source File: timeline.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def zoom_in(self): """Increase zoom factor and redraw TimeLine""" index = self._zoom_factors.index(self._zoom_factor) if index + 1 == len(self._zoom_factors): # Already zoomed in all the way return self._zoom_factor = self._zoom_factors[index + 1] if self._zoom_factors.index(self.zoom_factor) + 1 == len(self._zoom_factors): self._button_zoom_in.config(state=tk.DISABLED) self._button_zoom_out.config(state=tk.NORMAL) self.draw_timeline()
Example #26
Source File: timeline.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def zoom_out(self): """Decrease zoom factor and redraw TimeLine""" index = self._zoom_factors.index(self._zoom_factor) if index == 0: # Already zoomed out all the way return self._zoom_factor = self._zoom_factors[index - 1] if self._zoom_factors.index(self._zoom_factor) == 0: self._button_zoom_out.config(state=tk.DISABLED) self._button_zoom_in.config(state=tk.NORMAL) self.draw_timeline()
Example #27
Source File: timeline.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def zoom_reset(self): """Reset the zoom factor to default and redraw TimeLine""" self._zoom_factor = self._zoom_factors[0] if self._zoom_default == 0 else self._zoom_default if self._zoom_factors.index(self._zoom_factor) == 0: self._button_zoom_out.config(state=tk.DISABLED) self._button_zoom_in.config(state=tk.NORMAL) elif self._zoom_factors.index(self.zoom_factor) + 1 == len(self._zoom_factors): self._button_zoom_out.config(state=tk.NORMAL) self._button_zoom_in.config(state=tk.DISABLED) self.draw_timeline()
Example #28
Source File: SafeFrame.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def callSecurityCenter(self, msg): self.textScreen["state"] = tkinter.NORMAL self.textScreen.insert(tkinter.END, "{0} call! {1}\n".format(self.clockstring, msg)) self.textScreen.see(tkinter.END) self.textScreen["state"] = tkinter.DISABLED
Example #29
Source File: SafeFrame.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def recordLog(self, msg): self.textScreen["state"] = tkinter.NORMAL self.textScreen.insert(tkinter.END, "{0} record... {1}\n".format(self.clockstring, msg)) self.textScreen.see(tkinter.END) self.textScreen["state"] = tkinter.DISABLED
Example #30
Source File: gui.py From SneakyEXE with MIT License | 5 votes |
def BrowsingDestination(self): global VarDone self.Output = OpenUpPromptSelect.askdirectory() if not self.Output: self.Output = "" return None; if not PermissionCheckDir(self.Output): self.StatusCodeIndex = 9 if VarDone==2 or self.DirectoryChosen: self.ReSetInputName() VarDone-=1 self.Output = "" self.DirectoryChosen=False self.Directory.configure(state=tkinter.NORMAL) self.Directory.configure(fg="#7C8179") self.Directory.delete("1.0",tkinter.END) self.Directory.insert(tkinter.END,self.LanguagesEncoding[str(self.L[-1])][2]) self.Directory.configure(state=tkinter.DISABLED) self.MessageBox("error",self.Output+self.LanguagesEncoding[str(self.L[-1])][12]) return None self.DirectoryChosen=True if VarDone<2 and self.Directory.get("1.0",tkinter.END).split("\n")[0]==self.LanguagesEncoding[str(self.L[-1])][2]: VarDone += 1 self.Directory.configure(state=tkinter.NORMAL) self.Directory.configure(fg='black') self.Directory.delete("1.0",tkinter.END) self.Directory.insert(tkinter.END,self.Output) self.Directory.configure(state=tkinter.DISABLED)