當前位置: 首頁>>代碼示例>>Python>>正文


Python Tkinter.BooleanVar方法代碼示例

本文整理匯總了Python中Tkinter.BooleanVar方法的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter.BooleanVar方法的具體用法?Python Tkinter.BooleanVar怎麽用?Python Tkinter.BooleanVar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tkinter的用法示例。


在下文中一共展示了Tkinter.BooleanVar方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_entryconfigure_variable

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def test_entryconfigure_variable(self):
        m1 = self.create()
        v1 = tkinter.BooleanVar(self.root)
        v2 = tkinter.BooleanVar(self.root)
        m1.add_checkbutton(variable=v1, onvalue=True, offvalue=False,
                           label='Nonsense')
        self.assertEqual(str(m1.entrycget(1, 'variable')), str(v1))
        m1.entryconfigure(1, variable=v2)
        self.assertEqual(str(m1.entrycget(1, 'variable')), str(v2)) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:11,代碼來源:test_widgets.py

示例2: test_default

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def test_default(self):
        v = BooleanVar(self.root)
        self.assertEqual(False, v.get()) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:5,代碼來源:test_variables.py

示例3: test_get

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def test_get(self):
        v = BooleanVar(self.root, True, "name")
        self.assertAlmostEqual(True, v.get())
        self.root.globalsetvar("name", "0")
        self.assertAlmostEqual(False, v.get()) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:7,代碼來源:test_variables.py

示例4: test_invalid_value_domain

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def test_invalid_value_domain(self):
        v = BooleanVar(self.root, name="name")
        self.root.globalsetvar("name", "value")
        with self.assertRaises(TclError):
            v.get()
        self.root.globalsetvar("name", "1.0")
        with self.assertRaises(TclError):
            v.get() 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:10,代碼來源:test_variables.py

示例5: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
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?

    # Access methods 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:16,代碼來源:SearchEngine.py

示例6: set_tk_var

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def set_tk_var():
    global address
    address = StringVar()
    address.set(read_config("Proxy", "Address", "str"))
    global port
    port = IntVar()
    port.set(read_config("Proxy", "Port", "int"))
    global protocol
    protocol = StringVar()
    protocol.set(read_config("Proxy", "Protocol", "str"))
    global username
    username = StringVar()
    username.set(read_config("Proxy", "Username", "str"))
    global password
    password = StringVar()
    password.set(read_config("Proxy", "Password", "str"))
    global proxy_path_var
    proxy_path_var = StringVar()
    proxy_path = read_config("Proxy", "Path", "str")
    if len(proxy_path) == 0:
        proxy_path = path.join(data_dir, 'proxy.txt')
    proxy_path_var.set(proxy_path)
    global proxy_api
    proxy_api = StringVar()
    proxy_api.set(read_config("Proxy", "API", "str"))
    global test_address
    test_address = StringVar()
    test_address.set(read_config("Proxy", "TestAddress", "str"))
    global use_proxy
    use_proxy = BooleanVar()
    use_proxy.set(read_config("Proxy", "Proxy", "boolean")) 
開發者ID:shmilylty,項目名稱:cheetah-gui,代碼行數:33,代碼來源:cheetah_proxy_support.py

示例7: set_tk_var

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def set_tk_var():
    global method
    method = StringVar()
    method.set(read_config("Config", "Method", "str"))
    global server
    server = StringVar()
    server.set(read_config("Config", "Server", "str"))
    global shelltype
    shelltype = StringVar()
    shelltype.set(read_config("Config", "ShellType", "str"))
    global parameter
    parameter = StringVar()
    parameter.set(read_config("Config", "Parameter", "str"))
    global thread_num
    thread_num = IntVar()
    thread_num.set(read_config("Config", "ThreadNumber", "int"))
    global req_delay
    req_delay = DoubleVar()
    req_delay.set(read_config("Config", "RequestDelay", "float"))
    global time_out
    time_out = DoubleVar()
    time_out.set(read_config("Config", "RequestTimeout", "float"))
    global random_ua
    random_ua = BooleanVar()
    random_ua.set(read_config("Config", "RandomUserAgent", "boolean"))
    global con_close
    con_close = BooleanVar()
    con_close.set(read_config("Config", "ConnectionClose", "boolean"))
    global keep_alive
    keep_alive = BooleanVar()
    keep_alive.set(read_config("Config", "KeepAlive0", "boolean"))
    global custom_hdr
    custom_hdr = BooleanVar()
    custom_hdr.set(read_config("Config", "CustomRequestHeader", "boolean"))
    global custom_hdr_data
    custom_hdr_data = StringVar()
    custom_hdr_data.set(read_config("Config", "CustomRequestHeaderData", "str")) 
開發者ID:shmilylty,項目名稱:cheetah-gui,代碼行數:39,代碼來源:cheetah_config_support.py

示例8: define_variables

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def define_variables(self):
        self.solver_name = tk.StringVar(self.master)
        self.function = tk.StringVar(self.master)
        self.popsize = tk.IntVar(self.master)
        self.max_iter = tk.IntVar(self.master)
        self.interval = tk.IntVar(self.master)
        self.mcmc_stepsize_x1 = tk.DoubleVar(self.master)
        self.mcmc_stepsize_x2 = tk.DoubleVar(self.master)
        self.hmc_stepsize = tk.DoubleVar(self.master)
        self.log_mcmc_stepsize_x1 = tk.DoubleVar(self.master)
        self.log_mcmc_stepsize_x2 = tk.DoubleVar(self.master)
        self.log_hmc_stepsize = tk.DoubleVar(self.master)
        self.n_leap = tk.IntVar(self.master)
        self.w = tk.DoubleVar(self.master)
        self.c1 = tk.DoubleVar(self.master)
        self.c2 = tk.DoubleVar(self.master)
        self.gamma = tk.DoubleVar(self.master)
        self.CR = tk.DoubleVar(self.master)
        self.F = tk.DoubleVar(self.master)
        self.strategy = tk.StringVar(self.master)
        self.sigma = tk.DoubleVar(self.master)
        self.mu_perc = tk.DoubleVar(self.master)
        self.seed = tk.IntVar(self.master)
        self.fix_seed = tk.BooleanVar(self.master)
        self.constrain = tk.BooleanVar(self.master)
        self.sync = tk.BooleanVar(self.master) 
開發者ID:keurfonluu,項目名稱:stochopy,代碼行數:28,代碼來源:gui.py

示例9: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def __init__(self, text, cfg, key):
        self.checkbox = None
        self.enabled = True

        self.value = tk.BooleanVar()
        self.text = text
        self.cfg = cfg
        self.key = key
        try:
            if self.cfg[self.key] not in (True, False):
                self.value.set(False)
            else:
                self.value.set(self.cfg[self.key])
        except KeyError:
            self.value.set(False)  # default to False 
開發者ID:FowlerLab,項目名稱:Enrich2,代碼行數:17,代碼來源:dialog_elements.py

示例10: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def __init__(self, version):
        tk.Tk.__init__(self)
        self.title("Enrich 2 Configurator v{}".format(version))

        self.treeview = None
        self.treeview_popup_target_id = None

        self.cfg_file_name = tk.StringVar()

        self.element_dict = dict()
        self.root_element = None

        # analysis options
        self.scoring_method = tk.StringVar()
        self.logr_method = tk.StringVar()
        self.force_recalculate = tk.BooleanVar()
        self.component_outliers = tk.BooleanVar()
        self.plots_requested = tk.BooleanVar()
        self.tsv_requested = tk.BooleanVar()

        # allow resizing
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        # create UI elements
        self.create_main_frame()
        self.create_menubar()
        self.create_treeview_context_menu() 
開發者ID:FowlerLab,項目名稱:Enrich2,代碼行數:30,代碼來源:configurator.py

示例11: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def __init__(self, title='AirtestX Basic GUI', ratio=0.5, device=None):
        self._device = device
        self._root = tk.Tk()
        self._root.title(title)
        self._queue = Queue()

        self._refresh_text = tk.StringVar()
        self._refresh_text.set("Refresh")
        self._gencode_text = tk.StringVar()
        self._genfile_name = tk.StringVar()
        self._fileext_text = tk.StringVar()
        self._auto_refresh_var = tk.BooleanVar()
        self._uiauto_detect_var = tk.BooleanVar()
        self._attachfile_text = tk.StringVar()
        self._running = False # if background is running

        self._init_items()
        self._init_thread()
        self._init_refresh()

        self._lastx = 0
        self._lasty = 0
        self._bounds = None # crop area
        self._center = (0, 0) # center point
        self._offset = (0, 0) # offset to image center
        self._poffset = (0, 0)
        self._size = (90, 90)
        self._moved = False # click or click and move
        self._color = 'red' # draw color
        self._tkimage = None # keep reference
        self._image = None
        self._ratio = ratio
        self._uinodes = [] # ui dump
        self._selected_node = None
        self._hovered_node = None
        self._save_parent_dir = None

        self._init_vars() 
開發者ID:NetEaseGame,項目名稱:ATX,代碼行數:40,代碼來源:tkgui.py

示例12: setupOptFlags

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def setupOptFlags(self):
        self.optFlags = []
        flags = []
        if hasattr(self.options, 'optFlags'):
            flags.extend(self.options.optFlags)

        d = {}
        soFar = {}
        for meth in reflect.prefixedMethodNames(self.options.__class__, 'opt_'):
            full = 'opt_' + meth
            func = getattr(self.options, full)

            if not usage.flagFunction(func) or meth in ('help', 'version'):
                continue
            
            if soFar.has_key(func):
                continue
            soFar[func] = 1
            
            existing = d.setdefault(func, meth)
            if existing != meth:
                if len(existing) < len(meth):
                    d[func] = meth
            
            for (func, name) in d.items():
                flags.append((name, None, func.__doc__))
            
            if len(flags):
                self.optFrame = f = Tkinter.Frame(self)
                for (flag, _, desc) in flags:
                    b = Tkinter.BooleanVar()
                    c = Tkinter.Checkbutton(f, text=desc, variable=b, wraplen=200)
                    c.pack(anchor=Tkinter.W)
                    self.optFlags.append((flag, b))
                f.grid(row=1, column=1) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:37,代碼來源:tkmktap.py

示例13: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import BooleanVar [as 別名]
def __init__(self, parent, name):
			Tkinter.Frame.__init__(self, parent)
			self.checked = Tkinter.BooleanVar()
			checkbox = Tkinter.Checkbutton(self, variable=self.checked, command=save,
				padx=0, pady=0)
			checkbox.grid(row=0, column=0, sticky='E')
			nameLabel = Tkinter.Label(self, text=name, padx=0, pady=0)
			nameLabel.grid(row=0, column=1, sticky='W')
			self.batteryLabel = Tkinter.Label(self, text="", fg="#999999", padx=0, pady=0)
			self.batteryLabel.grid(row=1, column=0, columnspan=2, sticky='E')
			self.versionLabel = Tkinter.Label(self, text="", fg="#999999", padx=0, pady=0)
			self.versionLabel.grid(row=2, column=0, columnspan=2, sticky='E')

	# construct all the checkboxes 
開發者ID:USC-ACTLab,項目名稱:crazyswarm,代碼行數:16,代碼來源:chooser.py


注:本文中的Tkinter.BooleanVar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。