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


Python tkinter.BooleanVar类代码示例

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


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

示例1: __init__

class KRCCModule:
  __metaclass__ = ABCMeta

  def __init__(self):
    self._terminate = BooleanVar(False)
    self._id = StringVar(False)

  @property
  def terminate(self):
    return self._terminate.get()

  @terminate.setter
  def terminate(self, value):
    self._terminate.set(value)

  @property
  def id(self):
    return self._id.get()

  @id.setter
  def id(self, value):
    self._id.set(value)

  @abstractproperty
  def name(self):
    pass

  @abstractmethod
  def run(self):
    pass
开发者ID:jsartisohn,项目名称:krpc_scripts,代码行数:30,代码来源:krcc_module.py

示例2: __init__

    def __init__(self, client):
        # Basic setup
        super(Preferences, self).__init__()
        self.client = client

        # Setup the variables used
        self.echo_input = BooleanVar()
        self.echo_input.set(self.client.config['UI'].getboolean('echo_input'))
        self.echo_input.trace("w", self.echo_handler)
        self.logging = BooleanVar()
        self.logging.set(self.client.config['logging'].getboolean('log_session'))
        self.logging.trace('w', self.logging_handler)
        self.log_dir = self.client.config['logging']['log_directory']

        # Build the actual window and widgets
        prefs = Toplevel(self)
        prefs.wm_title("Preferences")
        echo_input_label = Label(prefs, text="Echo Input:")
        logging_label = Label(prefs, text='Log to file:')
        echo_checkbox = Checkbutton(prefs, variable=self.echo_input)
        logging_checkbox = Checkbutton(prefs, variable=self.logging)
        logging_button_text = 'Choose file...' if self.log_dir == "" else self.log_dir
        logging_button = Button(prefs, text=logging_button_text, command=self.logging_pick_location)

        # Pack 'em in.
        echo_input_label.grid(row=0, column=0)
        echo_checkbox.grid(row=0, column=1)
        logging_label.grid(row=1, column=0)
        logging_checkbox.grid(row=1, column=1)
        logging_button.grid(row=1, column=2)
开发者ID:Errorprone85,项目名称:TEC-Client,代码行数:30,代码来源:preferences.py

示例3: test_invalid_value_domain

 def test_invalid_value_domain(self):
     v = BooleanVar(self.root, name="name")
     self.root.globalsetvar("name", "value")
     with self.assertRaises(ValueError):
         v.get()
     self.root.globalsetvar("name", "1.0")
     with self.assertRaises(ValueError):
         v.get()
开发者ID:LesyaMazurevich,项目名称:python-1,代码行数:8,代码来源:test_variables.py

示例4: __init__

 def __init__(self, modelXbrl, tabWin, lang):
     super(ViewRenderedGrid, self).__init__(modelXbrl, tabWin, "Rendering", True, lang)
     self.newFactItemOptions = ModelInstanceObject.NewFactItemOptions(xbrlInstance=modelXbrl)
     self.factPrototypes = []
     self.zOrdinateChoices = None
     # context menu Boolean vars
     self.ignoreDimValidity = BooleanVar(value=True)
     self.xAxisChildrenFirst = BooleanVar(value=True)
     self.yAxisChildrenFirst = BooleanVar(value=False)
开发者ID:ojones20,项目名称:Arelle,代码行数:9,代码来源:ViewWinRenderedGrid.py

示例5: __init__

 def __init__(self, modelXbrl, tabWin, lang):
     super(ViewRenderedGrid, self).__init__(modelXbrl, tabWin, "Rendering", True, lang)
     self.newFactItemOptions = ModelInstanceObject.NewFactItemOptions(xbrlInstance=modelXbrl)
     self.factPrototypes = []
     self.zOrdinateChoices = None
     # context menu Boolean vars
     self.options = self.modelXbrl.modelManager.cntlr.config.setdefault("viewRenderedGridOptions", {})
     self.ignoreDimValidity = BooleanVar(value=self.options.setdefault("ignoreDimValidity",True))
     self.xAxisChildrenFirst = BooleanVar(value=self.options.setdefault("xAxisChildrenFirst",True))
     self.yAxisChildrenFirst = BooleanVar(value=self.options.setdefault("yAxisChildrenFirst",False))
开发者ID:DaveInga,项目名称:Arelle,代码行数:10,代码来源:ViewWinRenderedGrid.py

示例6: validateTableInfosetMenuEntender

def validateTableInfosetMenuEntender(cntlr, validateMenu):
    # Extend menu with an item for the save infoset plugin
    cntlr.modelManager.generateTableInfoset = cntlr.config.setdefault("generateTableInfoset",False)
    from tkinter import BooleanVar
    generateTableInfoset = BooleanVar(value=cntlr.modelManager.generateTableInfoset)
    def setTableInfosetOption(*args):
        cntlr.config["generateTableInfoset"] = cntlr.modelManager.generateTableInfoset = generateTableInfoset.get()
    generateTableInfoset.trace("w", setTableInfosetOption)
    validateMenu.add_checkbutton(label=_("Generate table infosets (instead of diffing them)"), 
                                 underline=0, 
                                 variable=generateTableInfoset, onvalue=True, offvalue=False)
开发者ID:Arelle,项目名称:Arelle,代码行数:11,代码来源:validateTableInfoset.py

示例7: __init__

    def __init__(self, root):
        '''Initialize Variables that save search state.

        The dialogs bind these to the UI elements present in the dialogs.
        '''
        self.root = root  # need for report_error()
        self.patvar = StringVar(root, '')   # search pattern
        self.revar = BooleanVar(root, False)   # regular expression?
        self.casevar = BooleanVar(root, False)   # match case?
        self.wordvar = BooleanVar(root, False)   # match whole word?
        self.wrapvar = BooleanVar(root, True)   # wrap around buffer?
        self.backvar = BooleanVar(root, False)   # search backwards?
开发者ID:10sr,项目名称:cpython,代码行数:12,代码来源:SearchEngine.py

示例8: __init__

 def __init__(self, modelXbrl, tabWin, lang):
     super(ViewRenderedGrid, self).__init__(modelXbrl, tabWin, "Table", True, lang)
     self.newFactItemOptions = ModelInstanceObject.NewFactItemOptions(xbrlInstance=modelXbrl)
     self.factPrototypes = []
     self.aspectEntryObjectIdsNode = {}
     self.aspectEntryObjectIdsCell = {}
     self.factPrototypeAspectEntryObjectIds = defaultdict(set)
     self.zOrdinateChoices = None
     # context menu Boolean vars
     self.options = self.modelXbrl.modelManager.cntlr.config.setdefault("viewRenderedGridOptions", {})
     self.openBreakdownLines = self.options.setdefault("openBreakdownLines", 5) # ensure there is a default entry
     self.ignoreDimValidity = BooleanVar(value=self.options.setdefault("ignoreDimValidity",True))
     self.xAxisChildrenFirst = BooleanVar(value=self.options.setdefault("xAxisChildrenFirst",True))
     self.yAxisChildrenFirst = BooleanVar(value=self.options.setdefault("yAxisChildrenFirst",False))
开发者ID:irjudson,项目名称:Arelle,代码行数:14,代码来源:ViewWinRenderedGrid.py

示例9: Preferences

class Preferences(Frame):
    def __init__(self, client):
        # Basic setup
        super(Preferences, self).__init__()
        self.client = client

        # Setup the variables used
        self.echo_input = BooleanVar()
        self.echo_input.set(self.client.config['UI'].getboolean('echo_input'))
        self.echo_input.trace("w", self.echo_handler)
        self.logging = BooleanVar()
        self.logging.set(self.client.config['logging'].getboolean('log_session'))
        self.logging.trace('w', self.logging_handler)
        self.log_dir = self.client.config['logging']['log_directory']

        # Build the actual window and widgets
        prefs = Toplevel(self)
        prefs.wm_title("Preferences")
        echo_input_label = Label(prefs, text="Echo Input:")
        logging_label = Label(prefs, text='Log to file:')
        echo_checkbox = Checkbutton(prefs, variable=self.echo_input)
        logging_checkbox = Checkbutton(prefs, variable=self.logging)
        logging_button_text = 'Choose file...' if self.log_dir == "" else self.log_dir
        logging_button = Button(prefs, text=logging_button_text, command=self.logging_pick_location)

        # Pack 'em in.
        echo_input_label.grid(row=0, column=0)
        echo_checkbox.grid(row=0, column=1)
        logging_label.grid(row=1, column=0)
        logging_checkbox.grid(row=1, column=1)
        logging_button.grid(row=1, column=2)

    def logging_pick_location(self):
        location = askdirectory(initialdir="%UserProfile%\Documents\\")
        self.client.config['logging']['log_directory'] = location
        self.write_config()

    def echo_handler(self, arg1, arg2, mode):
        pprint(self.echo_input.get())
        self.client.config['UI']['echo_input'] = 'yes' if self.echo_input.get() else 'no'
        self.write_config()

    def logging_handler(self, arg1, arg2, mode):
        self.client.config['logging']['log_session'] = 'yes' if self.logging.get else 'no'
        self.write_config()

    def write_config(self, file='config.ini'):
        self.client.config.write(open(file, 'w'))
开发者ID:Errorprone85,项目名称:TEC-Client,代码行数:48,代码来源:preferences.py

示例10: __init__

 def __init__(self, title="", message="", button="Ok", image=None,
              checkmessage="", style="clam", **options):
     """
         Create a messagebox with one button and a checkbox below the button:
             parent: parent of the toplevel window
             title: message box title
             message: message box text
             button: message displayed on the button
             image: image displayed at the left of the message
             checkmessage: message displayed next to the checkbox
             **options: other options to pass to the Toplevel.__init__ method
     """
     Tk.__init__(self, **options)
     self.resizable(False, False)
     self.title(title)
     s = Style(self)
     s.theme_use(style)
     if image:
         Label(self, text=message, wraplength=335,
               font="Sans 11", compound="left",
               image=image).grid(row=0, padx=10, pady=(10, 0))
     else:
         Label(self, text=message, wraplength=335,
               font="Sans 11").grid(row=0, padx=10, pady=(10, 0))
     b = Button(self, text=button, command=self.destroy)
     b.grid(row=2, padx=10, pady=10)
     self.var = BooleanVar(self)
     c = Checkbutton(self, text=checkmessage, variable=self.var)
     c.grid(row=1, padx=10, pady=0, sticky="e")
     self.grab_set()
     b.focus_set()
     self.wait_window(self)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:32,代码来源:custom_messagebox.py

示例11: init_widgets

    def init_widgets(self):
        # file selector
        self.btn_file_select=Button(self, text="Select file",command=self.on_select)
        self.btn_file_select.grid(column=0, row=0, columnspan=2)
        # filename
        self.filename, self.e_filename, self.l_filename = make_entry(self,"File name: ", 1)

        # delimiter
        self.delimiter, self.e_delimiter, self.l_delimiter = make_entry(self,"Delimiter: ", 2)

        # has_header
        self.l_has_header = ttk.Label(self, text="Has header: ")
        self.l_has_header.grid(column=0, row=3, sticky=W)
        self.has_header = BooleanVar()
        self.e_has_header = ttk.Checkbutton(self, variable=self.has_header)
        self.e_has_header.grid(column=1, row=3, sticky=W)

        # csv_dialect
        self.csv_dialect, self.e_csv_dialect, self.l_csv_dialect = make_entry(self,"CSV dialect: ", 4)

        # quoting
        self.quoting, self.e_quoting, self.l_quoting = make_entry(self, "Quoting: ", 5)

        # escapechar
        self.escapechar, self.e_escapechar, self.l_escapechar = make_entry(self, "Escape character: ", 6)

        # lineterminator
        self.lineterminator, self.e_lineterminator, self.l_lineterminator = make_entry(self, "Line terminator: ", 7)

        # quotechar
        self.quotechar, self.e_quotechar, self.l_quotechar = make_entry(self, "Quote character: ", 8)

        # skipinitialspace
        self.skipinitialspace, self.e_skipinitialspace, self.l_skipinitialspace = make_entry(self, "Skip initial space: ", 9)
开发者ID:OptimalBPM,项目名称:qal,代码行数:34,代码来源:frame_dataset_flatfile.py

示例12: build_widgets

 def build_widgets(self):
     "Build the various widgets that will be used in the program."
     # Create processing frame widgets.
     self.processing_frame = LabelFrame(self, text='Processing Mode:')
     self.mode_var = StringVar(self, 'encode')
     self.decode_button = Radiobutton(self.processing_frame,
                                      text='Decode Cipher-Text',
                                      command=self.handle_radiobuttons,
                                      value='decode',
                                      variable=self.mode_var)
     self.encode_button = Radiobutton(self.processing_frame,
                                      text='Encode Plain-Text',
                                      command=self.handle_radiobuttons,
                                      value='encode',
                                      variable=self.mode_var)
     self.freeze_var = BooleanVar(self, False)
     self.freeze_button = Checkbutton(self.processing_frame,
                                      text='Freeze Key & Primer',
                                      command=self.handle_checkbutton,
                                      offvalue=False,
                                      onvalue=True,
                                      variable=self.freeze_var)
     # Create encoding frame widgets.
     self.encoding_frame = LabelFrame(self, text='Encoding Options:')
     self.chain_size_label = Label(self.encoding_frame, text='Chain Size:')
     self.chain_size_entry = Entry(self.encoding_frame)
     self.plain_text_label = Label(self.encoding_frame, text='Plain-Text:')
     self.plain_text_entry = Entry(self.encoding_frame)
     # Create input frame widgets.
     self.input_frame = LabelFrame(self, text='Input Area:')
     self.input_text = ScrolledText(self.input_frame, **self.TEXT)
     # Create output frame widgets.
     self.output_frame = LabelFrame(self, text='Output Area:')
     self.output_text = ScrolledText(self.output_frame, **self.TEXT)
开发者ID:jacob-carrier,项目名称:code,代码行数:34,代码来源:recipe-578076.py

示例13: init_widgets

    def init_widgets(self):
        # file selector
        self.btn_file_select = Button(self, text="Select file", command=self.on_select)
        self.btn_file_select.grid(column=0, row=0, columnspan=2)

        # filename
        self.filename, self.e_filename, self.l_filename = make_entry(self, "File name: ", 1)


        # delimiter
        self.delimiter, self.e_delimiter, self.l_delimiter = make_entry(self, "Delimiter: ", 2)

        # has_header
        self.l_has_header = ttk.Label(self, text="Has header: ")
        self.l_has_header.grid(column=0, row=3, sticky=W)
        self.has_header = BooleanVar()
        self.e_has_header = ttk.Checkbutton(self, variable=self.has_header)
        self.e_has_header.grid(column=1, row=3, sticky=W)

        # sheet_name
        self.sheet_name, self.e_sheet_name, self.l_sheet_name = make_entry(self, "Sheet name: ", 4)

        # x_offset
        self.x_offset, self.e_x_offset, self.l_x_offset = make_entry(self, "X offset: ", 5)


        # y_offset
        self.y_offset, self.e_y_offset, self.l_y_offset = make_entry(self, "Y offset: ", 6)
开发者ID:OptimalBPM,项目名称:qal,代码行数:28,代码来源:frame_dataset_spreadsheet.py

示例14: __init__

    def __init__(self, _master, _mapping = None,
                 _on_get_source_references = None,
                 _on_get_destination_references = None,
                 _on_select = None):
        super(FrameMapping, self).__init__(_master)


        # Add monitored variables.
        self.is_key = BooleanVar()
        self.src_reference = StringVar()
        self.src_datatype = StringVar()
        self.curr_data = StringVar()

        self.result_cast_to = StringVar()
        self.preview = StringVar()

        self.dest_reference = StringVar()

        self.on_get_source_references = _on_get_source_references
        self.on_get_destination_references = _on_get_destination_references

        self.on_select = _on_select
        self.init_widgets()

        self.mapping = _mapping



        if _mapping is not None:
            self.mapping_to_gui()
开发者ID:OptimalBPM,项目名称:qal,代码行数:30,代码来源:frame_mapping.py

示例15: initData

 def initData(self):
    self.browseInitialDir = def_initialDir
    
    self.recentFile = def_recentFile
    
    self.menuOutputAudio = StringVar()
    self.menuOutputAudio.set(def_menuOutputAudio)
    
    self.menuVideoRefresh = BooleanVar()
    self.menuVideoRefresh.set(def_menuVideoRefresh)
    
    self.menuBgBlack = BooleanVar()
    self.menuBgBlack.set(def_menuBgBlack)
    
    self.maxRecentVideos = def_maxRecentVideos
    
    self.moreOptions = def_moreOptions
    
    self.playProcess = None
开发者ID:frama986,项目名称:omx-simple-interface,代码行数:19,代码来源:guiController.py


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