当前位置: 首页>>代码示例>>Python>>正文


Python tkinter.DISABLED属性代码示例

本文整理汇总了Python中tkinter.DISABLED属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.DISABLED属性的具体用法?Python tkinter.DISABLED怎么用?Python tkinter.DISABLED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在tkinter的用法示例。


在下文中一共展示了tkinter.DISABLED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_modified

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:18,代码来源:Main.py

示例2: update_ui

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:24,代码来源:Main.py

示例3: update_recent_files_menu

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:19,代码来源:Main.py

示例4: calculation_stop

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:mahdavipanah,项目名称:pynpuzzle,代码行数:19,代码来源:pynpuzzle.py

示例5: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:20,代码来源:tkwidgets.py

示例6: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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") 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:19,代码来源:price_display.py

示例7: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:21,代码来源:menu_editor.py

示例8: radio_btn_change

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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') 
开发者ID:araith,项目名称:pyDEA,代码行数:24,代码来源:options_frame_gui.py

示例9: disable

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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('') 
开发者ID:araith,项目名称:pyDEA,代码行数:20,代码来源:table_gui.py

示例10: change_state_if_needed

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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) 
开发者ID:araith,项目名称:pyDEA,代码行数:23,代码来源:table_gui.py

示例11: descargaVideo

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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.") 
开发者ID:jjr4Programmer,项目名称:proyectoDownloader,代码行数:22,代码来源:Controlador.py

示例12: cargarInfoDesdePL

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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.") 
开发者ID:jjr4Programmer,项目名称:proyectoDownloader,代码行数:21,代码来源:Controlador.py

示例13: onTokenRightClick

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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() 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:35,代码来源:graph_canvas.py

示例14: sign_in

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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 
开发者ID:LonamiWebs,项目名称:Telethon,代码行数:30,代码来源:gui.py

示例15: set_signed_in

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import DISABLED [as 别名]
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 
开发者ID:LonamiWebs,项目名称:Telethon,代码行数:17,代码来源:gui.py


注:本文中的tkinter.DISABLED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。