• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tkinter.BooleanVar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: addValidateMenuTools

def addValidateMenuTools(cntlr, validateMenu, name, map_name):
    # Extend menu with an item for the save infoset plugin
    attr_name = 'validate{}'.format(name.strip())
    attr_value = cntlr.config.setdefault(attr_name, False)
    setattr(cntlr.modelManager, attr_name, attr_value)
    #cntlr.modelManager.validateDQC = cntlr.config.setdefault("validateDQC",False)
    from tkinter import BooleanVar
    validate_var = BooleanVar(value=getattr(cntlr.modelManager, attr_name))
    
    def setValidateXuleOption(*args):
        setattr(cntlr.modelManager, attr_name, validate_var.get())
        cntlr.config[attr_name] = getattr(cntlr.modelManager, attr_name)
        
    validate_var.trace("w", setValidateXuleOption)
    validateMenu.add_checkbutton(label=_("{} Rules".format(name)), 
                                 underline=0, 
                                 variable=validate_var, onvalue=True, offvalue=False)


    xuleRegisterValidators(name, map_name, validate_var)
开发者ID:davidtauriello,项目名称:dqc_us_rules,代码行数:20,代码来源:__init__.py


示例17: __init__

    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)

        # Set window title
        self.wm_title('Plastey Configurator')

        # Create GUI driven variables
        self._mode       = BooleanVar()
        self._base       = BooleanVar()
        self._comm       = BooleanVar()
        self._pass       = StringVar()
        self._addressed  = StringVar()
        self._connected  = StringVar()
        self._this_host  = StringVar()
        self._this_port  = StringVar()
        self._other_host = StringVar()
        self._other_port = StringVar()

        # Create GUI
        self._build_gui()

        # Set default values for GUI driven variables
        self._mode.set(MODE_SINGLE_PLAYER)
        self._base.set(BASE_OPENED_GEOMETRY)
        self._comm.set(COMM_SOCKET_SERVER)
        self._pass.set('')
        self._addressed.set(ADDR_HAVE_ADDRESS if check(COMM_THIS_HOST) else ADDR_NO_ADDRESS)
        self._connected.set(CONN_NOT_CONNECTED)
        self._this_host.set(COMM_THIS_HOST)
        self._this_port.set(COMM_THIS_PORT)
        self._other_host.set(COMM_THIS_HOST)
        self._other_port.set(COMM_OTHER_PORT)

        # Follow changes on password
        self._pass.trace('w', self._on_bind_address)

        # Create folder structures if they don't exists yet
        makedirs(FILE_TEMPORARY_FOLDER,  exist_ok=True)
        makedirs(FILE_PERMANENT_FOLDER,  exist_ok=True)
        makedirs(FILE_TEMP_SAVE_FOLDER,  exist_ok=True)
        makedirs(FILE_AUTO_SAVE_FOLDER,  exist_ok=True)
开发者ID:kitchenbudapest,项目名称:vr,代码行数:41,代码来源:plastey.py


示例18: __init__

 def __init__(self, parent):
     Frame.__init__(self, parent)
     self.parent = parent
     self.pack(fill=BOTH, expand=True)
     self.parent.title("youtube-dl GUI")
     # Initialise variables
     self._extract_audio = BooleanVar()
     self._video_url = StringVar()
     self._output_path = StringVar()
     # Initialise
     self._logger = LogWindow(self)
     self._init_ui()
开发者ID:pielambr,项目名称:ydlui,代码行数:12,代码来源:main.py


示例19: __init__

    def __init__(self, pype, toplevel=False, filename=False, num_sequences=10,
                 run_tag=''):
        '''
        '''
        self.pype = pype
        self.toplevel = toplevel

        self.keep_runningVar = BooleanVar(value=True)
        self.extend_runVar = BooleanVar(value=False)
        self.run_typeVar = StringVar(value="/tmp/")
        self.run_tagVar = StringVar(value=run_tag)
        self.num_sequencesVar = IntVar(value=num_sequences)
        self.sequence_spacingVar = DoubleVar(value=0)
        self.len_sequenceVar = DoubleVar()
        self.stateVar = StringVar(value='done')
        self.conf_filename = StringVar(value='')
        self.params = {}
        self.runthread = multiprocessing.Process()

        self._GetParamFuncs()
        if toplevel:
            self._BuildGui()
开发者ID:project8,项目名称:Pypeline,代码行数:22,代码来源:data_run_gui.py


示例20: test_invalid_value_domain

 def test_invalid_value_domain(self):
     false = 0 if self.root.wantobjects() else "0"
     v = BooleanVar(self.root, name="name")
     with self.assertRaises(TclError):
         v.set("value")
     self.assertEqual(self.root.globalgetvar("name"), false)
     self.root.globalsetvar("name", "value")
     with self.assertRaises(ValueError):
         v.get()
     self.root.globalsetvar("name", "1.0")
     with self.assertRaises(ValueError):
         v.get()
开发者ID:Cartmanfku,项目名称:cpython,代码行数:12,代码来源:test_variables.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tkinter.Button类代码示例发布时间:2022-05-27
下一篇:
Python tkinter.mainloop函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap