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


Python tkinter.Checkbutton方法代码示例

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


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

示例1: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def __init__(self, parent, mainWindow, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.mainWindow = mainWindow
        self.columnconfigure(1, weight=1)
        
        tk.Frame(self, height="20", width="10").grid(row="0", column="1", columnspan="2")
        
        checkboxValue = tk.BooleanVar()
        checkboxValue.set(settings.detailsWindowShow)
        self.windowDisabled = tk.Checkbutton(self, text="Show Pilot Breakdown window", variable=checkboxValue)
        self.windowDisabled.var = checkboxValue
        self.windowDisabled.grid(row="1", column="1", columnspan="2")
        
        tk.Frame(self, height="20", width="10").grid(row="2", column="1", columnspan="2")
        
        self.makeListBox() 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:19,代码来源:detailSettingsFrame.py

示例2: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        gridFrame = self._nametowidget(parent.winfo_parent())
        self.parent = self._nametowidget(gridFrame.winfo_parent())
        
        self.grid(row="0", column="0", sticky="ew")
        self.columnconfigure(0,weight=1)
        self.singleLabel = singleLabel = tk.Label(self, text=title)
        singleLabel.grid(row="0",column="0", sticky="ew")
        self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0)
        listbox.delete(0,tk.END)
        listbox.insert(0,decimalPlaces)
        listbox.grid(row="0", column="1")
        checkboxValue = tk.IntVar()
        checkboxValue.set(inThousands)
        self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0)
        checkbox.var = checkboxValue
        checkbox.grid(row="0", column="2")
        singleLabel.bind("<Button-1>", lambda e:self.dragStart(e, listbox, checkbox)) 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:21,代码来源:labelSettingsFrame.py

示例3: create_infos

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def create_infos(self):
    self.info_frame = tk.Frame()
    self.info_frame.grid(row=0,column=1)
    self.fps_label = tk.Label(self.info_frame,text="fps:")
    self.fps_label.pack()
    self.auto_range = tk.IntVar()
    self.range_check = tk.Checkbutton(self.info_frame,
                      text="Auto range",variable=self.auto_range)
    self.range_check.pack()
    self.auto_apply = tk.IntVar()
    self.auto_apply_check = tk.Checkbutton(self.info_frame,
                      text="Auto apply",variable=self.auto_apply)
    self.auto_apply_check.pack()
    self.minmax_label = tk.Label(self.info_frame,text="min: max:")
    self.minmax_label.pack()
    self.range_label = tk.Label(self.info_frame,text="range:")
    self.range_label.pack()
    self.bits_label = tk.Label(self.info_frame,text="detected bits:")
    self.bits_label.pack()
    self.zoom_label = tk.Label(self.info_frame,text="Zoom: 100%")
    self.zoom_label.pack()
    self.reticle_label = tk.Label(self.info_frame,text="Y:0 X:0 V=0")
    self.reticle_label.pack() 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:25,代码来源:cameraConfig.py

示例4: create_widgets

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def create_widgets(self, **kwargs):
    """
    Widgets shown:
    - The frame's title,
    - The checkbutton to enable/disable displaying,
    - The textbox.

    """
    self.top_frame = tk.Frame(self)
    tk.Label(self.top_frame,
        text=kwargs.get('title', '')).grid(row=0, column=0)

    tk.Checkbutton(self.top_frame,
                   variable=self.enabled_checkbox,
                   text="Display?").grid(row=0, column=1)

    self.serial_monitor = tk.Text(self,
                                  relief="sunken",
                                  height=int(self.total_width / 10),
                                  width=int(self.total_width),
                                  font=tkFont.Font(size=kwargs.get("fontsize",
                                                                   13)))

    self.top_frame.grid(row=0)
    self.serial_monitor.grid(row=1) 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:27,代码来源:arduino_basics.py

示例5: _Button

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def _Button(self, text, image_file, toggle, frame):
        if image_file is not None:
            im = tk.PhotoImage(master=self, file=image_file)
        else:
            im = None

        if not toggle:
            b = tk.Button(master=frame, text=text, padx=2, pady=2, image=im,
                          command=lambda: self._button_click(text))
        else:
            # There is a bug in tkinter included in some python 3.6 versions
            # that without this variable, produces a "visual" toggling of
            # other near checkbuttons
            # https://bugs.python.org/issue29402
            # https://bugs.python.org/issue25684
            var = tk.IntVar()
            b = tk.Checkbutton(master=frame, text=text, padx=2, pady=2,
                               image=im, indicatoron=False,
                               command=lambda: self._button_click(text),
                               variable=var)
        b._ntimage = im
        b.pack(side=tk.LEFT)
        return b 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:25,代码来源:_backend_tk.py

示例6: _Button

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def _Button(self, text, image_file, toggle, frame):
        if image_file is not None:
            im = Tk.PhotoImage(master=self, file=image_file)
        else:
            im = None

        if not toggle:
            b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im,
                          command=lambda: self._button_click(text))
        else:
            # There is a bug in tkinter included in some python 3.6 versions
            # that without this variable, produces a "visual" toggling of
            # other near checkbuttons
            # https://bugs.python.org/issue29402
            # https://bugs.python.org/issue25684
            var = Tk.IntVar()
            b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2,
                               image=im, indicatoron=False,
                               command=lambda: self._button_click(text),
                               variable=var)
        b._ntimage = im
        b.pack(side=Tk.LEFT)
        return b 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:25,代码来源:_backend_tk.py

示例7: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent)
        self.title = tk.Label(self, text='SV Length')

        self.len_GT_On = tk.IntVar(value=0)
        self.len_GT_On_CB = tk.Checkbutton(self, text=">", justify=tk.LEFT, variable=self.len_GT_On)
        self.len_GT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
        self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)

        self.len_LT_On = tk.IntVar(value=0)
        self.len_LT_On_CB = tk.Checkbutton(self, text="<", justify=tk.LEFT, variable=self.len_LT_On)
        self.len_LT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
        self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)

        self.title.grid(row=0, column=0, sticky=tk.EW, columnspan=4)
        self.len_GT_On_CB.grid(row=1, column=0, sticky=tk.EW)
        self.len_GT_val.grid(row=2, column=0, sticky=tk.EW)
        self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW)
        self.len_LT_On_CB.grid(row=1, column=2, sticky=tk.EW)
        self.len_LT_val.grid(row=2, column=2, sticky=tk.EW)
        self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW) 
开发者ID:VCCRI,项目名称:SVPV,代码行数:23,代码来源:gui_widgets.py

示例8: edit_experimental_settings

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def edit_experimental_settings(self):
        """Settings menu for experimental features."""

        self.experimental_settings_container = tk.Toplevel(bg='white')
        self.experimental_settings_container.geometry('300x400')
        self.experimental_settings_container.wm_title('Experimental settings')
        self.experimental_settings_container.protocol(
            'WM_DELETE_WINDOW', self.experimental_settings_container.destroy)

        tk.Button(self.experimental_settings_container, text='Save and close',
                  command=self.experimental_settings_container.destroy).pack()

        experimental_settings_cb = tk.Checkbutton(
            self.experimental_settings_container,
            text="Enable experimental settings",
            variable=self.settings['experimental_settings'],
            height=2, width=20, bg='white')
        experimental_settings_cb.pack(expand=True)
        tip = dedent("""Enable experimental settings.""")
        ToolTip(experimental_settings_cb, text=tip, wraplength=750) 
开发者ID:NeuromorphicProcessorProject,项目名称:snn_toolbox,代码行数:22,代码来源:gui.py

示例9: create_advance

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def create_advance(self):
        '''
        高级菜单
        '''
        advance = tk.LabelFrame(self.main_frame1, text='高级选项')
        advance.pack(padx=5, pady=5, fill=tk.X, side=tk.BOTTOM)
        tk.Checkbutton(advance, text='调试模式',
                       variable=self.debug_enable).pack(anchor=tk.W)
        tk.Checkbutton(advance, text='超时自动关闭阴阳师',
                       variable=self.watchdog_enable).pack(anchor=tk.W)
        frame = tk.Frame(advance)
        frame.pack(anchor=tk.W)
        tk.Label(frame, text='  画面超时时间(秒):').grid(row=0, column=0)
        tk.Entry(frame, textvariable=self.max_win_time,
                 width=5).grid(row=0, column=1)
        tk.Label(frame, text='  操作超时时间(秒):').grid(row=1, column=0)
        tk.Entry(frame, textvariable=self.max_op_time,
                 width=5).grid(row=1, column=1) 
开发者ID:AcademicDog,项目名称:onmyoji_bot,代码行数:20,代码来源:tkui.py

示例10: render_boolearn

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def render_boolearn(self, info):
        y = (len(self.register_params) + 1) * 40
        self.y_ = y + 40
        name = info["name"]
        label = tk.Label(self, text=name.replace("_", " ") + " :", font=(None, 10))
        label.place(x=0, y=y)

        check = tk.IntVar()
        check_button = tk.Checkbutton(self, text="{} ?".format(name),
                                      variable=check, onvalue=1, offvalue=0,
                                      height=4, width=10, font=(None, 10))
        x = len(name) * 10
        check_button.place(x=x, y=y - 20)
        if info.get("default", None):
            check.set(1)
        else:
            check.set(0)
        self.register_params[name] = (check, info["type"]) 
开发者ID:MashiMaroLjc,项目名称:rabbitVE,代码行数:20,代码来源:plugin_view.py

示例11: _init_rulelabel

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def _init_rulelabel(self, parent):
        ruletxt = 'Last edge generated by:'

        self._rulelabel1 = tkinter.Label(parent,text=ruletxt,
                                         font=self._boldfont)
        self._rulelabel2 = tkinter.Label(parent, width=40,
                                         relief='groove', anchor='w',
                                         font=self._boldfont)
        self._rulelabel1.pack(side='left')
        self._rulelabel2.pack(side='left')
        step = tkinter.Checkbutton(parent, variable=self._step,
                                   text='Step')
        step.pack(side='right') 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:15,代码来源:chartparser_app.py

示例12: open_special_dlg

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def open_special_dlg(self):
        '''Open a popup for selecting special characters
        '''
        self.special_dlg = Tk.Toplevel()
        self.special_dlg.withdraw()
        self.special_dlg.title('Select Special Characters')
        self.special_dlg.resizable(width=False, height=False)
        frame = Tk.Frame(self.special_dlg)
        lb = Tk.Label(frame, text='Select Special Characters'.format(self.title))
        lb.pack(fill='both', side='top')

        box = Tk.Frame(frame)
        self.chk_special = []
        max_column_checks = 15
        for v, val in enumerate(SPECIAL_CHARACTERS):
            var = Tk.IntVar()
            tmp = Tk.Checkbutton(box, text=val, relief=Tk.FLAT, variable=var)
            self.chk_special.append(var)
            tmp.grid(row=v % max_column_checks, column=v // max_column_checks,
                     sticky='W', padx=10)
        box.pack(fill='both', side='top', padx=30, pady=20)

        # Ok and Cancel buttons
        btn_box = Tk.Frame(frame)
        btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_special)
        btn_cancel.pack(side='right', padx=10, pady=20)
        btn_ok = Tk.Button(btn_box, text='Ok', command=self.on_ok_special_dlg)
        btn_ok.pack(side='left', padx=10, pady=20)
        btn_box.pack()
        frame.pack(fill='both', padx=60, pady=10)
        
        center_window(self.special_dlg, self.main.master)
        self.special_dlg.focus_set() 
开发者ID:sc0tfree,项目名称:mentalist,代码行数:35,代码来源:adder.py

示例13: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.variables = defaultdict(tk.StringVar)
        self.exits_var = [tk.IntVar() for i in range(4)]
        for var in self.exits_var:
            var.set(1)

        self.exits_frame = tk.Frame(self)
        self.form_entries = OrderedDict()
        self.form_labels = OrderedDict()
        self.form_exits = OrderedDict()
        self.form_entries_names = ('Location Name', 'Description', 'NPCs', 'Icon', "Submaps")
        self.exits_names = ('N', 'S', 'E', 'W')
        self.position_variable = tk.StringVar()
        self.position_variable.set('(0, 0)')
        self.position_label_lbl = tk.Label(self, text='Position : ')
        self.position_label = tk.Label(self, textvariable=self.position_variable)
        for entry in self.form_entries_names:
            self.form_labels[entry] = tk.Label(self, text=entry + ' :')
            if not entry == 'Description':
                self.form_entries[entry] = tk.Entry(self, textvariable=self.variables[entry], width=20)
            else:
                self.form_entries[entry] = tk.Text(self, width=20)
        for i, ext in enumerate(self.exits_names):
            self.form_exits[ext + '_label'] = tk.Label(self.exits_frame, text=ext + " :")
            self.form_exits[ext + '_checkbox'] = tk.Checkbutton(self.exits_frame, variable=self.exits_var[i])
        self.exits_label = tk.Label(self, text='Exits :')
        self.save_button = tk.Button(self, text='Save', command=self.save_btn)
        self.setup_ui() 
开发者ID:Dogeek,项目名称:rpg-text,代码行数:31,代码来源:map-creator.py

示例14: makeCheckbox

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def makeCheckbox(self, initValue, boxText, description=None):
        checkboxValue = tk.BooleanVar()
        checkboxValue.set(initValue)
        checkbox = tk.Checkbutton(self, text=boxText, variable=checkboxValue)
        checkbox.var = checkboxValue
        checkbox.grid(row=self.row, column="1", columnspan="2")
        self.row += 1
        if description:
            descriptor = tk.Label(self, text=description)
            font = tkFont.Font(font=descriptor['font'])
            font.config(slant='italic')
            descriptor['font'] = font
            descriptor.grid(row=self.row, column="1", columnspan="2")
            self.row += 1
        return checkbox 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:17,代码来源:fleetSettingsFrame.py

示例15: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Checkbutton [as 别名]
def __init__(self, parent, mainWindow, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.mainWindow = mainWindow
        
        self.columnconfigure(0, weight=1)
        self.columnconfigure(4, weight=1)
        self.configure(pady=10)
        tk.Frame(self, height="0", width="1").grid(row="0", column="0")
        tk.Frame(self, height="0", width="1").grid(row="0", column="4")
        self.counter = 0
        
        checkboxValue = tk.BooleanVar()
        checkboxValue.set(settings.getGraphDisabled())
        self.graphDisabled = tk.Checkbutton(self, text="Disable graph entirely", variable=checkboxValue)
        self.graphDisabled.var = checkboxValue
        self.graphDisabled.grid(row=self.counter, column="1", columnspan="2")
        descriptor = tk.Label(self, text="Labels will still be shown")
        font = tkFont.Font(font=descriptor['font'])
        font.config(slant='italic')
        descriptor['font'] = font
        descriptor.grid(row=self.counter+1, column="1", columnspan="2")
        tk.Frame(self, height="20", width="10").grid(row=self.counter+2, column="1", columnspan="5")
        self.counter += 3
        
        self.secondsVar = tk.StringVar()
        self.secondsVar.set(settings.getSeconds())
        self.addSetting(self.secondsVar, "Number of seconds to average values:", 
                        "Recommended to set this value higher than your weapon cycle time")
        
        self.intervalVar = tk.StringVar()
        self.intervalVar.set(settings.getInterval())
        self.addSetting(self.intervalVar, "How often to update graph/labels in milliseconds:", 
                        "The lower you set this value, the higher your CPU usage will be")
        
        self.transparencyVar = tk.StringVar()
        self.transparencyVar.set(settings.getCompactTransparency())
        self.addSetting(self.transparencyVar, "Window transparency percentage in compact mode:", 
                        "100 is fully visible, 0 is invisible") 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:40,代码来源:generalSettingsFrame.py


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