Python tkinter.DISABLED Examples
The following are 30
code examples of tkinter.DISABLED().
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: Main.py From python-in-practice with GNU General Public License v3.0 | 7 votes |
def update_ui(self, *args): guiState = self.state.value if guiState == WORKING: text = "Cancel" underline = 0 if not TkUtil.mac() else -1 state = "!" + tk.DISABLED elif guiState in {CANCELED, TERMINATING}: text = "Canceling..." underline = -1 state = tk.DISABLED elif guiState == IDLE: text = "Scale" underline = 1 if not TkUtil.mac() else -1 state = ("!" + tk.DISABLED if self.sourceText.get() and self.targetText.get() else tk.DISABLED) self.scaleButton.state((state,)) self.scaleButton.config(text=text, underline=underline) state = tk.DISABLED if guiState != IDLE else "!" + tk.DISABLED for widget in (self.sourceEntry, self.sourceButton, self.targetEntry, self.targetButton): widget.state((state,)) self.master.update() # Make sure the GUI refreshes
Example #3
Source File: Controlador.py From proyectoDownloader with MIT License | 7 votes |
def descargaVideo(self): """ Método encargado de llamar al método __descargaVideo, según lo seleccionado por el usuario además que se ejecuta en un hilo distinto """ index = self.vista.listbox.curselection() if len(index) > 0: self.seleccion = self.streams[index[0]] self.size = self.seleccion.get_filesize() self.mostrarDialogo() t = threading.Thread(target=self.__descargarVideo) t.start() self.vista.button.config(state=DISABLED) self.vista.bvideo.config(state=DISABLED) self.vista.baudio.config(state=DISABLED) self.vista.bborrar.config(state=DISABLED) else: msg.showerror("Error", "Se debe seleccionar un video de la lista.")
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: Main.py From python-in-practice with GNU General Public License v3.0 | 6 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 #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: tkwidgets.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, char, font=("Courier", 14)): super().__init__(parent, bd=2, relief=tk.RAISED, bg="black", fg="white", font=font) if not char.strip(): self["state"] = tk.DISABLED self["relief"] = tk.FLAT self["bd"] = 0 self.char = char self.target = None self.configure(text=self.char, command=self.on_press) Key.all_keys.append(self)
Example #8
Source File: price_display.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, text, textvariable, **kwargs): super().__init__(parent, **kwargs) self.label = tk.Label(self, text=text, font=self.font, anchor=tk.E) self.entry = tk.Entry(self, textvariable=textvariable, font=self.font, width=len("$ 000.00"), state=tk.DISABLED, disabledforeground="black", disabledbackground="white") self.label.grid(row=0, column=0, sticky="nswe") self.entry.grid(row=0, column=1, sticky="nswe")
Example #9
Source File: menu_editor.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, menu_item=None): super().__init__(parent) if menu_item is None: menu_item = lib.MenuItem("", "", 0, {}, "", 0) self.removed = True self.category = menu_item.category self.item = menu_item.name self.price = menu_item.price self.price_entry["font"] = self.font self.item_entry.configure(font=self.font, state=tk.DISABLED, disabledforeground="black") self.options_bt = lib.LabelButton(self, text="Options", width=7, font=self.font) self.remove_bt = lib.LabelButton(self, text="Remove", width=7, font=self.font, command=self.grid_remove) self.options_bt.grid(row=0, column=2, sticky="nswe", padx=2) self.remove_bt.grid(row=0, column=3, sticky="nswe", padx=2)
Example #10
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 #11
Source File: table_gui.py From pyDEA with MIT License | 6 votes |
def disable(self, internal_col, category_name): ''' Disables Checkbutton. Args: internal_col (int): internal column index. category_name (str): name of category. ''' self.config(state=DISABLED) if category_name: if self.var.get() == 1: self.category_frame.remove_category(category_name) if self.opposite_var.get() == 1: self.opposite_category_frame.remove_category(category_name) if category_name in self.current_categories: assert(internal_col < len(self.current_categories)) self.current_categories[internal_col] = '' if category_name == self.combobox_text_var.get(): self.combobox_text_var.set('')
Example #12
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 #13
Source File: Controlador.py From proyectoDownloader with MIT License | 6 votes |
def cargarInfoDesdePL(self): index = self.vista.listPL.curselection() if len(index) > 0: if platform.system() == 'Windows': self.vista.config(cursor="wait") self.recurso = self.recursoPL['items'][index[0]]['pafy'] self.vista.button.config(state=DISABLED) self.vista.bvideo.config(state=DISABLED) self.vista.baudio.config(state=DISABLED) self.vista.bborrar.config(state=DISABLED) self.t = threading.Thread(target=self.cargarInfo) self.t.start() else: msg.showerror("Error", "Se debe seleccionar un video de la lista.")
Example #14
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def onTokenRightClick(self, event): item = self._get_id(event) popup = tk.Menu(self, tearoff=0) popup.add_command(label='Grow', command=lambda: self.grow_node(item), accelerator='G') popup.add_command(label='Grow until...', command=lambda: self.grow_until(item)) popup.add_command(label='Mark', command=lambda: self.mark_node(item), accelerator='M') popup.add_command(label='Hide', command=lambda: self.hide_node(item), accelerator='H') hide_behind = tk.Menu(popup, tearoff=0) for _, n in self.dispG.edges_iter(item): assert _ == item if self._radial_behind(item, n): state = tk.ACTIVE else: state = tk.DISABLED hide_behind.add_command(label=str(self.dispG.node[n]['dataG_id']), state=state, command=lambda item=item, n=n: self.hide_behind(item, n)) popup.add_cascade(label='Hide Behind', menu=hide_behind) token = self.dispG.node[item]['token'] token.customize_menu(popup, item) try: popup.post(event.x_root, event.y_root) finally: popup.grab_release()
Example #15
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 #16
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 #17
Source File: map-creator.py From rpg-text with MIT License | 5 votes |
def __init__(self, master=None): super().__init__(master) self.text = tk.Text(self, width=80, height=40) self.vsb = tk.Scrollbar(self, command=self.text.yview) self.text.pack(side=tk.LEFT, expand=True, fill=tk.BOTH) self.vsb.pack(side=tk.RIGHT, expand=True, fill=tk.Y) self.text.insert(tk.END, HELP_TXT) self.text.config(state=tk.DISABLED, xscrollcommand=self.vsb.set)
Example #18
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 #19
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def menu_bar_show_logs_command(): """ Show logs menu button click handler """ global logs_window global logs_text # If there is another show logs window open if logs_window: # Bring the window to front logs_window.lift() return # Logs window logs_window = tkinter.Toplevel(main_window) logs_window.title("Logs") logs_window.geometry('680x252') logs_window.lift() # ScrolledText widget logs_text = scrolledtext.ScrolledText(logs_window, state=tkinter.DISABLED) logs_text.pack(fill=tkinter.BOTH, expand=True) # Load logs to text widget update_logs_text_if_visible() def on_close(): """ Logs window 'on close' handler """ global logs_text global logs_window logs_text = None logs_window.destroy() logs_window = None logs_window.protocol('WM_DELETE_WINDOW', on_close) # Show the window logs_window.mainloop()
Example #20
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def change_app_n(n): """ Refreshes app based on new n. """ global input_puzzle_frame global output_puzzle_frame global GOAL_STATE # Recreate input puzzle input_puzzle_frame = create_puzzle_frame(input_labelframe, n, input_puzzle_frame) # Recreate output puzzle output_puzzle_frame = create_puzzle_frame(output_labelframe, n, output_puzzle_frame, True) config_io_frame_state(output_labelframe, tkinter.DISABLED) # Regenerate goal state GOAL_STATE = [i for i in range(n + 1)] # Clear status bar ram_var.set('') max_ram_var.set('') cpu_var.set('') # n spinbox
Example #21
Source File: pynpuzzle.py From pynpuzzle with MIT License | 5 votes |
def play_button_command(): """ Output's play button click handler Start playing the output steps one by one. """ global play_event global play_timer def playing(): """ Target function for play_thread Plays output step's one by one with one second delay between them. """ time.sleep(1) while not play_event.is_set(): next_step_button() if OUTPUT_STEP == int(output_to_label['text']): output_stop_button_cmd() return play_event.wait(1) # Disable play button output_play_button['state'] = tkinter.DISABLED # Enable stop button output_stop_button['state'] = tkinter.NORMAL # If output's step is already the last one, change the step to the first step so it can be played from beginning if OUTPUT_STEP == int(output_to_label['text']): load_output_step(0) play_event = threading.Event() play_timer = threading.Thread(target=playing) play_timer.start() # Output's play button widget
Example #22
Source File: annotation_gui.py From SEM with MIT License | 5 votes |
def update_level(self): for i in range(self.adder.max_depth()): if i != self.adder.current_hierarchy_level: self.type_combos[i].configure(state=tkinter.DISABLED) else: levels = (self.adder.current_annotation.levels if self.adder.current_annotation is not None else []) subtrie = self.adder.shortcut_trie.goto(levels) keys = sorted([key for key in subtrie if key != NUL]) for j in range(len(keys)): shortcut = subtrie[keys[j]][NUL] keys[j] += " ({0} or Shift+{0})".format(shortcut) self.type_combos[i]["values"] = [self.SELECT_TYPE] + keys self.type_combos[i].configure(state="readonly")
Example #23
Source File: fleetConnectionWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 5 votes |
def login(self): self.loginNotificationQueue = multiprocessing.Queue() #settings.fleetServer = self.serverVar.get() requestArgs = "/sso/login?read_fleet=esi-fleets.read_fleet.v1" if self.modeVar.get() == 1: requestArgs += "&login_type=member" else: requestArgs += "&write_fleet=esi-fleets.write_fleet.v1" requestArgs += "&login_type=fc" self.sockMgr = socketManager.SocketManager(self.serverVar.get(), self.characterName, requestArgs, self.loginNotificationQueue) self.sockMgr.start() self.loginButton.configure(state=tk.DISABLED) self.loginWindowThread = threading.Thread(target=self.waitForLogin, daemon=True) self.loginWindowThread.start()
Example #24
Source File: mainWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 5 votes |
def addMenus(self): # character menu options are added dynamically by CharacterDetector, so we pass this into that self.characterMenu = tk.Menubutton(text="Character...", background="black", fg="white", borderwidth="1", highlightbackground="black", highlightthickness="1", activebackground="gray25", activeforeground="white") self.characterMenu.grid(row="5", column="2") self.characterMenu.menu = tk.Menu(self.characterMenu, tearoff=False) self.characterMenu["menu"] = self.characterMenu.menu self.characterDetector = logreader.CharacterDetector(self, self.characterMenu) # Set up file menu options self.mainMenu = tk.Menubutton(text="File...", background="black", fg="white", borderwidth="1", highlightbackground="black", highlightthickness="1", activebackground="gray25", activeforeground="white") self.mainMenu.grid(row="5", column="1") self.mainMenu.menu = tk.Menu(self.mainMenu, tearoff=False) self.mainMenu["menu"] = self.mainMenu.menu self.mainMenu.menu.add_command(label="Edit Profile Settings", command=lambda: settingsWindow.SettingsWindow(self)) # add all the profiles from settings into the menu self.profileMenu = tk.Menu(self.mainMenu, tearoff=False) settings.initializeMenu(self) self.mainMenu.menu.add_cascade(label="Profile", menu=self.profileMenu) self.mainMenu.menu.add_separator() self.mainMenu.menu.add_command(label="Clear Total/Peak Values", state=tk.DISABLED) self.mainMenu.menu.add_separator() self.mainMenu.menu.add_command(label="Fleet Mode", command=lambda: fleetConnectionWindow.FleetWindow(self)) self.mainMenu.menu.add_separator() self.mainMenu.menu.add_command(label="Simulate Input", command=lambda: simulationWindow.SimulationWindow(self)) getLogFilePath = lambda: tk.filedialog.askopenfilename(initialdir=self.characterDetector.path, title="Select log file") self.mainMenu.menu.add_command(label="Playback Log", command=lambda: self.characterDetector.playbackLog(getLogFilePath())) self.mainMenu.menu.add_separator() self.mainMenu.menu.add_command(label="Quit", command=self.quitEvent)
Example #25
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 #26
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def create_widgets(self): self.findLabel = TkUtil.Label(self, text="Find:", underline=1) self.findEntry = ttk.Entry(self, width=25) self.replaceLabel = TkUtil.Label(self, text="Replace:", underline=1) self.replaceEntry = ttk.Entry(self, width=25) self.caseSensitiveCheckbutton = TkUtil.Checkbutton(self, text="Case Sensitive", underline=5, variable=self.caseSensitive) self.wholeWordsCheckbutton = TkUtil.Checkbutton(self, text="Whole Words", underline=0, variable=self.wholeWords) self.findButton = TkUtil.Button(self, text="Find", underline=0, command=self.find, default=tk.ACTIVE, state=tk.DISABLED) self.replaceButton = TkUtil.Button(self, text="Replace", underline=0, command=self.replace, state=tk.DISABLED) self.closeButton = TkUtil.Button(self, text="Close", underline=0, command=self.close) if TkUtil.x11(): self.extendButton = TkUtil.ToggleButton(self, text="Extend", underline=1, command=self.toggle_extend) else: self.extendButton = ttk.Button(self, text="Extend", underline=1, command=self.toggle_extend, image=self.images[UNEXTEND], compound=tk.LEFT) self.extensionWidgets = (self.replaceLabel, self.replaceEntry, self.replaceButton)
Example #27
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def update_ui(self, event=None): state = "!" + tk.DISABLED if self.findEntry.get() else tk.DISABLED self.findButton.state((state,)) self.replaceButton.state((state,)) # We allow the replace button to be enabled even if there's no # replacement text since the user might want to replace # something with nothing.
Example #28
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 #29
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 #30
Source File: MeterLogin.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def update_ui(self, event=None): state = "!" + tk.DISABLED if self.validate() else tk.DISABLED self.acceptButton.state((state,))