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: 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 #3
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 #4
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 #5
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 #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: 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 #8
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 #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: 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 #11
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 #12
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 #13
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 #14
Source File: check_output.py From Python-3-Object-Oriented-Programming-Third-Edition with MIT License | 5 votes |
def count_next(self): self.total_count += 1 percentage = self.right_count / self.total_count self.percent_accurate["text"] = f"{percentage:.0%}" try: color_text, color_bg = self.next_color() except StopIteration: color_text = "DONE" color_bg = "#ffffff" self.color_box["text"] = "DONE" self.yes_button["state"] = tk.DISABLED self.no_button["state"] = tk.DISABLED self.color_label["text"] = color_text self.color_box["bg"] = color_bg
Example #15
Source File: ULAI14.py From mcculw with MIT License | 5 votes |
def start(self): self.start_button["state"] = tk.DISABLED self.start_scan()
Example #16
Source File: ULAO04.py From mcculw with MIT License | 5 votes |
def start(self): self.high_channel_entry["state"] = tk.DISABLED self.low_channel_entry["state"] = tk.DISABLED self.start_button["command"] = self.stop self.start_button["text"] = "Stop" self.start_scan()
Example #17
Source File: ULTI02.py From mcculw with MIT License | 5 votes |
def start(self): self.running = True self.start_button["command"] = self.stop self.start_button["text"] = "Stop" self.low_channel_entry["state"] = tk.DISABLED self.high_channel_entry["state"] = tk.DISABLED self.low_chan = self.get_low_channel_num() self.high_chan = self.get_high_channel_num() self.recreate_data_frame() self.update_values()
Example #18
Source File: table_gui.py From pyDEA with MIT License | 5 votes |
def _create_input_output_box(self, column_index): ''' Creates Checkbuttons used for choosing input and output categories. Args: column_index (int): index of a column for which Checkbuttons must be created. ''' frame_for_btns = Frame(self.frame_with_table) self.frames.append(frame_for_btns) input_var = IntVar() output_var = IntVar() input_btn = ObserverCheckbutton( frame_for_btns, input_var, output_var, self.params_frame.input_categories_frame, self.params_frame.output_categories_frame, self.current_categories, self.cells, INPUT_OBSERVER, self.params_frame.change_category_name, self.data, self.combobox_text_var, text='Input', state=DISABLED) input_btn.grid(row=1, column=0, sticky=N+W) output_btn = FollowingObserverCheckbutton( frame_for_btns, output_var, input_var, self.params_frame.output_categories_frame, self.params_frame.input_categories_frame, self.current_categories, self.cells, OUTPUT_OBSERVER, self.params_frame.change_category_name, self.data, self.combobox_text_var, input_btn, text='Output', state=DISABLED) output_btn.grid(row=2, column=0, sticky=N+W) self._add_observers(input_btn, output_btn, column_index + 1) var = IntVar() column_checkbox = CheckbuttonWithVar(frame_for_btns, var) column_checkbox.grid(row=0, column=0) self.col_checkboxes.append((column_checkbox, var)) frame_for_btns.grid(row=1, column=column_index + 2, sticky=N)
Example #19
Source File: ULAI02.py From mcculw with MIT License | 5 votes |
def start(self): self.start_button["state"] = tk.DISABLED self.start_scan()
Example #20
Source File: ULAI08.py From mcculw with MIT License | 5 votes |
def start(self): self.start_button["state"] = tk.DISABLED self.start_scan()
Example #21
Source File: legofy_gui.py From Legofy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.chosenFile = None self.chosenFilePath = tk.StringVar() self.pathField = tk.Entry(self, width=40, textvariable=self.chosenFilePath, state=tk.DISABLED) self.pathField.grid(row=0, column=0, padx=10) self.selectFile = tk.Button(self, text="Choose file...", command=self.choose_a_file) self.selectFile.grid(row=0, column=1) self.groupFrame = tk.LabelFrame(self, text="Params", padx=5, pady=5) self.groupFrame.grid(row=1, column=0, columnspan=2, ) self.colorPaletteLabel = tk.Label(self.groupFrame, text = 'Color Palette') self.colorPaletteLabel.grid(row=0, column=0 ) self.colorPalette = ttk.Combobox(self.groupFrame) self.colorPalette['values'] = LEGO_PALETTE self.colorPalette.current(0) self.colorPalette.grid(row=0, column=1) self.brickNumberScale = tk.Scale(self.groupFrame, from_=1, to=200, orient=tk.HORIZONTAL, label="Number of bricks (longer edge)", length=250) self.brickNumberScale.set(30) self.brickNumberScale.grid(row=1, column=0, columnspan=2, ) self.convertFile = tk.Button(text="Legofy this image!", command=self.convert_file) self.convertFile.grid(row=2, column=0, columnspan=2)
Example #22
Source File: server_widgets.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, **kwargs) label = tk.Label(self, text="Current Time: ", font=self.font) variable = tk.StringVar(self) entry = tk.Entry(self, textvariable=variable, font=self.font, state=tk.DISABLED, disabledforeground="black", disabledbackground="white") label.grid(row=0, column=0, sticky="nswe") entry.grid(row=0, column=1, sticky="nswe") self.set = variable.set self.get = variable.get
Example #23
Source File: checkout_display.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def ticket_number(self, **kwargs): frame = tk.Frame(self.interior, **kwargs) label = tk.Label(frame, text="Next Ticket", font=self.font) entry = tk.Entry(frame, textvariable=self._ticket, font=self.font, width=5, state=tk.DISABLED, disabledforeground="black", disabledbackground="white") label.grid(row=0, column=0, sticky="nswe") entry.grid(row=0, column=1, sticky="nswe") return frame
Example #24
Source File: checkout_display.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def labeled_entry(self, text, variable, state=tk.DISABLED, **kwargs): frame = tk.Frame(self, **kwargs) label = tk.Label(frame, font=self.font, text=text) entry = tk.Entry(frame, font=self.font, textvariable=variable, state=state, width=10, disabledbackground="white", disabledforeground="black") label.grid(row=0, column=0, sticky="nse") entry.grid(row=0, column=1, sticky="nsw") return frame
Example #25
Source File: console.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def write(self, content): content = content.decode('utf-8') self.configure(state=tk.NORMAL) self.insert(tk.END, content) self.configure(state=tk.DISABLED)
Example #26
Source File: console.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, width=80, bg="grey26", fg="white", state=tk.DISABLED, **kwargs)
Example #27
Source File: progress_tab.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, **kwargs) self.widgets = WidgetCache(TicketEditor, self, initial_size=4) tk.Label(self, width=3, font=ItemEditor.font).grid(row=0, column=0, sticky="nswe", padx=2, ipadx=2) self.calculator_frame = tk.Frame(self, bd=2, relief=tk.RIDGE) self.calculator = EditorCalculator(self.calculator_frame) self._difference = tk.StringVar(self) self.difference_label = tk.Label(self.calculator_frame, text="Difference ", font=ItemEditor.font) self.difference_entry = tk.Entry(self.calculator_frame, textvariable=self._difference, font=ItemEditor.font, state=tk.DISABLED, disabledforeground="black", disabledbackground="white", width=10) self.difference_label.grid(row=0, column=0, sticky="w") self.difference_entry.grid(row=0, column=1, sticky="w") self.calculator.grid(row=1, column=0, sticky="w", columnspan=2) self.calculator_frame.grid(row=0, column=1, sticky="nswe", columnspan=2, pady=2, padx=2) self.ticket_no = None self.orderprogress = None self.is_gridded = False self.original_total = None
Example #28
Source File: titlebar.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, width=11, font=self.font, state=tk.DISABLED, disabledbackground="white", disabledforeground="black", relief=tk.RIDGE, **kwargs) self._time = tk.StringVar(self) self["textvariable"] = self._time lib.AsyncTk().add_task(self.update_time())
Example #29
Source File: tkwidgets.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, width=11, state=tk.DISABLED, disabledbackground="white", disabledforeground="black", relief=tk.RIDGE, **kwargs) self._time = tk.StringVar(self) self["textvariable"] = self._time
Example #30
Source File: tkwidgets.py From hwk-mirror with GNU General Public License v3.0 | 5 votes |
def write_enable(func): @wraps(func) def wrapper(*args, **kwargs): self = args[0] self["state"] = tk.NORMAL func(*args, **kwargs) self["state"] = tk.DISABLED return wrapper