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


Python tkinter.Checkbutton类代码示例

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


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

示例1: PasswordDialog

class PasswordDialog(Dialog):

    def __init__(self, title, prompt, parent):
        self.prompt = prompt
        Dialog.__init__(self, parent, title)

    def body(self, master):
        from tkinter import Label
        from tkinter import Entry
        from tkinter import Checkbutton
        from tkinter import IntVar
        from tkinter import W

        self.checkVar = IntVar()

        Label(master, text=self.prompt).grid(row=0, sticky=W)

        self.e1 = Entry(master)

        self.e1.grid(row=0, column=1)

        self.cb = Checkbutton(master, text="Save to keychain", variable=self.checkVar)
        self.cb.pack()
        self.cb.grid(row=1, columnspan=2, sticky=W)
        self.e1.configure(show='*')

    def apply(self):
        self.result = (self.e1.get(), self.checkVar.get() == 1)
开发者ID:WaffleTime,项目名称:GUIDE,代码行数:28,代码来源:password_dialog.py

示例2: create_other_buttons

    def create_other_buttons(self):
        f = self.make_frame()[0]

        btn = Checkbutton(f, anchor="w",
                variable=self.recvar,
                text="Recurse down subdirectories")
        btn.pack(side="top", fill="both")
        btn.select()
开发者ID:belzner,项目名称:idle-errors-uap,代码行数:8,代码来源:GrepDialog.py

示例3: initUI

    def initUI(self):

        self.parent.title("Checkbutton")

        self.pack(fill=BOTH, expand=1)
        self.var = IntVar()

        cb = Checkbutton(self, text="Show title", variable=self.var, command=self.onClick)
        cb.select()
        cb.place(x=50, y=50)
开发者ID:hangyeolkim91,项目名称:python3_document,代码行数:10,代码来源:example_tk_4_checkbox.py

示例4: openfile

def openfile():
    
    name = askopenfilename()
    nam = name.split("/")
    g=nam[-1].split(".")
    grup= g[0]
    print(nam,g)
    print(grup)
    fitxer = open(name, mode='r')
    
    
    for linia in fitxer:
        coordinates = linia.split('\t')
        N,X,Y,Z,C = coordinates           
        N = coordinates[0]
        X = coordinates[1]
        Y = coordinates[2]
        Z = coordinates[3]
        C = [coordinates[4]]
        if len(coordinates)>5:
            i=5
            for c in range(len(coordinates)-5):
                C.append(coordinates[i])
                codis.add(c)
                i = i+1
        codis.add(C[0])
        
    i= 0   
    r = 2 
    c = 1
    
    
    if askyesno('codis...','Vols unir per codis?'):
        codis_linia.clear()
        tria = tk.Toplevel()
        ok = tk.Button(tria, text='ok', width=25, command=tria.destroy)
        ok.grid(column=0, row=0,columnspan=5)
       
        
        
        for item in codis:
            codis_linia[str(item)]= IntVar()
            
            chb =Checkbutton(tria,text = str(item), variable = codis_linia[item], onvalue = True, offvalue = False, height=5 )
            if c > 5:
                c = 1
                r = r+1
            
            chb.grid(column =c, row=r)
            c = c+1
        label2.config(text= 'Quins codis son linies')  
开发者ID:ihipi,项目名称:topopy,代码行数:51,代码来源:Gui.py

示例5: __init__

    def __init__(self, master):
        column0_padx = 24
        row_pady = 36

        #Label 1
        lbl_testcase_exec = Label(master, text="Test case execution",
                                  wraplength=100, anchor='w', justify='left')
        lbl_results_cmp = Label(master, text="Results comparison",
                                wraplength=100, justify='left')
        lbl_tolerance = Label(master, text="Tolerance (5%)", wraplength=100)
        testcase_exec = Checkbutton(master)
        results_cmp = Checkbutton(master)
        tolerance = Entry(master, width=4)
        lbl_analysis = Label(master, text="Analysis Library")
        analysis_lib = Entry(master, width=30)

        lbl_testcase_exec.grid(row=0, column=2, padx=20, pady=12, sticky='w')
        lbl_results_cmp.grid(row=0, column=3, pady=12, sticky='w')
        lbl_tolerance.grid(row=0, column=4, padx=20, pady=12, sticky='wn')
        lbl_analysis.grid(row=1, column=0, sticky='w', padx=column0_padx)
        analysis_lib.grid(row=1, column=1, sticky='w')
        testcase_exec.grid(row=1, column=2, padx=20, sticky='w')
        results_cmp.grid(row=1, column=3, sticky='w')
        tolerance.grid(row=1, column=4, padx=20, sticky='w')

        #Label 2
        lbl_ref_analysis = Label(
            master, text="Reference Analysis Libary Version",
            wraplength=150, justify='left', pady=row_pady)
        ref_analysis_lib = Entry(master, width=30)
        lbl_ref_analysis.grid(row=2, column=0, sticky='w', padx=column0_padx)
        ref_analysis_lib.grid(row=2, column=1, sticky='w')

        # version
        lbl_version = Label(master, text="Version under Test")
        version = Label(master, text="vA.B.C.D")
        lbl_version.grid(row=3, column=0, sticky='w', padx=column0_padx)
        version.grid(row=3, column=1, sticky='w')

        # test all
        lbl_testall = Label(master, text="Test All")
        testall = Checkbutton(master)
        lbl_testall.grid(row=4, column=0, pady=row_pady, padx=column0_padx,
                         sticky='w')
        testall.grid(row=4, column=1, sticky='w')

        # buttons
        bottom_frame = Frame(master)
        bottom_frame.grid(row=5, column=1, columnspan=3, sticky='w')

        btn_start = Button(bottom_frame, text = "Go", width=7)
        btn_start.pack(side='left')
        btn_commit = Button(bottom_frame, text="Commit", width=7)
        btn_commit.pack(side='left', padx=80)
        btn_exit = Button(bottom_frame, text="Exit", width=7)
        btn_exit.pack(side='left')
开发者ID:ShrikanthRamanathan,项目名称:python-exercises,代码行数:56,代码来源:grid-layout.py

示例6: ConfigWindow

class ConfigWindow(Toplevel):
    '''Represent the configuration window.'''
    
    def __init__(self, parent=None):
        '''Constructor of ConfigWindow.'''
        Toplevel.__init__(self, parent)
        self.title('Configuracion')
        self._states = [IntVar(value=CONFIG['GAME_TRACKING']), 
                        IntVar(value=CONFIG['CONFIRM_EXIT'])]
        self._cbox_gtrack = Checkbutton(self, text='Seguimiento del juego')
        self._cbox_gtrack.config(variable=self._states[0])
        self._cbox_confexit = Checkbutton(self, text='Confirmacion al salir')
        self._cbox_confexit.config(variable=self._states[1])
        self._cbox_gtrack.grid(row=0, column=0, sticky=W)
        self._cbox_confexit.grid(row=1, column=0, sticky=W)
        self._button_cancel = Button(self, text='Cancelar', command=self.destroy)
        self._button_cancel.grid(row=3, column=1, sticky=E)
        self._button_accept = Button(self, text='Guardar y Salir')
        self._button_accept.config(command=self.save_config)
        self._button_accept.grid(row=3, column=0, sticky=E)
        
    def save_config(self):
        pass
        
    def get_state_game_tracking(self):
        return self._states[0].get()
    
    def get_state_confirm_exit(self):
        return self._states[1].get()
开发者ID:ngarbezza,项目名称:pysenku,代码行数:29,代码来源:pysenku-0.5.py

示例7: create_option_buttons

 def create_option_buttons(self):
     "Fill frame with Checkbuttons bound to SearchEngine booleanvars."
     frame = self.make_frame("Options")[0]
     engine = self.engine
     options = [(engine.revar, "Regular expression"),
                (engine.casevar, "Match case"),
                (engine.wordvar, "Whole word")]
     if self.needwrapbutton:
         options.append((engine.wrapvar, "Wrap around"))
     for var, label in options:
         btn = Checkbutton(frame, anchor="w", variable=var, text=label)
         btn.pack(side="left", fill="both")
         if var.get():
             btn.select()
     return frame, options  # for test
开发者ID:google,项目名称:cpython-pt,代码行数:15,代码来源:SearchDialogBase.py

示例8: create_option_buttons

    def create_option_buttons(self):
        """Return (filled frame, options) for testing.

        Options is a list of SearchEngine booleanvar, label pairs.
        A gridded frame from make_frame is filled with a Checkbutton
        for each pair, bound to the var, with the corresponding label.
        """
        frame = self.make_frame("Options")[0]
        engine = self.engine
        options = [(engine.revar, "Regular expression"), (engine.casevar, "Match case"), (engine.wordvar, "Whole word")]
        if self.needwrapbutton:
            options.append((engine.wrapvar, "Wrap around"))
        for var, label in options:
            btn = Checkbutton(frame, anchor="w", variable=var, text=label)
            btn.pack(side="left", fill="both")
            if var.get():
                btn.select()
        return frame, options
开发者ID:alexandremetgy,项目名称:MrPython,代码行数:18,代码来源:SearchDialogBase.py

示例9: __init__

 def __init__(self):
     Tk.__init__(self)
     self.minsize(200, 250)
     self.result = None
     self._model_name = ''
     self._icon_name = ''
     self.title("Viewer generator")
     self.grid_columnconfigure(0, weight=0)
     self.grid_columnconfigure(1, weight=1)
     self.grid_rowconfigure(0, weight=0)
     self.grid_rowconfigure(1, weight=1)
     self.resizable(True, True)
     Label(self, text='Model').grid(row=0, column=0, sticky=(N, E))
     self.models = ttk.Combobox(
         self, textvariable=StringVar(), state='readonly')
     self.models.grid(row=0, column=1, sticky=(N, W, E, S), padx=3, pady=3)
     mainframe = Frame(self, bd=1, relief=SUNKEN)
     mainframe.grid(
         row=1, column=0, columnspan=2, sticky=(N, S, E, W), padx=3, pady=3)
     current_row = 0
     current_col = 0
     self.check = []
     for value in ('add', 'list', 'edit', 'search', 'modify', 'listing', 'show', 'label', 'delete', 'print'):
         chkbtn_val = IntVar()
         chkbtn = Checkbutton(mainframe, text=value, variable=chkbtn_val)
         chkbtn.grid(
             row=current_row, column=current_col, sticky=W, padx=3, pady=3)
         self.check.append((value, chkbtn_val))
         current_col += 1
         if current_col == 2:
             current_col = 0
             current_row += 1
     Label(mainframe, text='Icon').grid(
         row=(current_row + 1), column=0, columnspan=2, sticky=(N, W, E, S), padx=3)
     self.icons = ttk.Combobox(
         mainframe, textvariable=StringVar(), state='readonly')
     self.icons.grid(
         row=(current_row + 2), column=0, columnspan=2, sticky=(N, W, E, S), padx=3)
     btnframe = Frame(self, bd=1)
     btnframe.grid(row=2, column=0, columnspan=2)
     Button(btnframe, text="OK", width=10, command=self.cmd_ok).grid(
         row=1, column=0, sticky=(N, S, E, W), padx=5, pady=3)
     Button(btnframe, text="Cancel", width=10, command=self.cmd_cancel).grid(
         row=1, column=1, sticky=(N, S, E, W), padx=5, pady=3)
开发者ID:Lucterios2,项目名称:core,代码行数:44,代码来源:viewer_generator.py

示例10: __init__

 def __init__(self,master=None):
     Frame.__init__(self,master)
     #Sides of Dice
     labelSides=Label(self,text="Sides")
     labelSides.grid(row=0,column=0)
     self.sides=StringVar()
     self.sides.set(20)
     spinboxSides=Spinbox(self,from_=1,to=20,increment=1,width=4)
     spinboxSides.config(textvariable=self.sides, font="sans 24", justify="center")
     spinboxSides.grid(row=0,column=1)
     #Number of Dices
     labelNumber=Label(self,text="Number")
     labelNumber.grid(row=1,column=0)
     self.number=StringVar()
     self.number.set(1)
     spinboxNumber=Spinbox(self,from_=1,to=30,increment=1,width=4)
     spinboxNumber.config(textvariable=self.number, font="sans 24", justify="center")
     spinboxNumber.grid(row=1,column=1)
     #Modifier
     labelModifier=Label(self,text="Modifier")
     labelModifier.grid(row=2,column=0)
     self.modifier=StringVar()
     self.modifier.set(0)
     spinboxModifier=Spinbox(self,from_=-5,to=5,increment=1,width=4)
     spinboxModifier.config(textvariable=self.modifier, font="sans 24", justify="center")
     spinboxModifier.grid(row=2,column=1)
     #Hide Checkbox
     labelHide=Label(self, text="Hide")
     labelHide.grid(row=2, column=2)
     self.hide=IntVar()
     self.hide.set(0)
     checkbuttonHide=Checkbutton(self,variable=self.hide)
     checkbuttonHide.grid(row=2,column=3)
     #Result display
     self.result=StringVar()
     self.result.set("")
     labelResult1=Label(self,text="Result")
     labelResult1.grid(row=1, column=4)
     labelResult2=Label(self,text=self.result.get(),relief=SUNKEN,width=4)
     labelResult2.grid(row=1,column=5)
     #Button to roll
     buttonRoll=Button(self,text="Roll!", command=self.roll)
     buttonRoll.grid(row=2,column=5)
开发者ID:jkesselring,项目名称:DnDApp,代码行数:43,代码来源:dice.py

示例11: _makesetting

def _makesetting(setting_window, conf):
    setting_label = Label(setting_window,
                          text=_('Setting'),
                          font=('courier', 20, 'bold'))
    setting_label.pack(side=TOP)

    style_container = Frame(setting_window)
    style_container.pack(side=TOP)
    style_label = Label(style_container,
                        text=_('Display wallpaper in style: '),
                        font=('courier', 15, 'bold'))
    style_label.pack(side=LEFT)
    style_combobox = Combobox(style_container)
    available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
    style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
    style_combobox.state(['readonly'])
    style_combobox.current(int(conf['style']))
    style_combobox.pack(side=LEFT)

    random_container = Frame(setting_window)
    random_container.pack(side=TOP)
    random_label = Label(random_container,
                         text=_('Choose wallpaper randomly? '),
                         font=('courier', 15, 'bold'))
    random_label.pack(side=LEFT)
    random_checkbutton = Checkbutton(random_container)
    random_checkbutton.pack(side=LEFT)
    if conf['random'] == "1":
        random_checkbutton.select()

    interval_container = Frame(setting_window)
    interval_container.pack(side=TOP)
    interval_label = Label(interval_container,
                           text=_('Change wallpaper every '),
                           font=('courier', 15, 'bold'))
    interval_label.pack(side=LEFT)
    interval_text = Text(interval_container, height=1, width=4)
    interval_text.insert(END, conf['interval'])
    interval_text.pack(side=LEFT)
    minute_label = Label(interval_container,
                         text=_(' minutes.'),
                         font=('courier', 15, 'bold'))
    minute_label.pack(side=LEFT)
开发者ID:funagi,项目名称:wallpapoz,代码行数:43,代码来源:wallpapoz_main_window.py

示例12: _init_ui

 def _init_ui(self):
     # Label to specify video link
     lbl_video_url = Label(self, text="Video URL:")
     lbl_video_url.place(x=20, y=20)
     # Entry to enter video url
     entr_video_url = Entry(self, width=50, textvariable=self._video_url)
     entr_video_url.place(x=100, y=20)
     # Checkbutton to extract audio
     cb_extract_audio = Checkbutton(self, var=self._extract_audio, text="Only keep audio")
     cb_extract_audio.pack()
     cb_extract_audio.place(x=20, y=60)
     # Button to browse for location
     b_folder_choose = Button(self, text="Choose output directory", command=self.ask_directory)
     b_folder_choose.place(x=150, y=90)
     # Button to start downloading
     b_start_download = Button(self, text="Start download", command=self.download)
     b_start_download.place(x=20, y=90)
     # Log window to log progress
     self._logger.place(x=20, y=130)
开发者ID:pielambr,项目名称:ydlui,代码行数:19,代码来源:main.py

示例13: __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

示例14: __init__

 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady = True
     
     self.vsb  = Scrollbar(self, orient="vertical")
     self.text = Text(
         self, height = 10,
         yscrollcommand=self.vsb.set,
         bg = self.master.cget('bg'),
         wrap = 'word')
     self.vsb.config(command=self.text.yview)
     self.vsb.pack(side='right', fill='y')
     self.text.pack(side='left', fill='both', expand=True)
     
     # Create the list of checkboxes
     self._listOfTypes = []
     for currType in dsTypes.__all__:
         v = BooleanVar(value = 1)
         cb = Checkbutton(self, text = '%s' % currType, anchor = W,
                          width = 15, variable = v)
         cb.var = v # Easy access to checkbox's current value
         
         e  = Entry(self)
         e.delete(0, END)
         e.insert(0, '<suffix>.<file_extension>')
         
         self._listOfTypes.append((cb, e))
         self.text.window_create('end', window=cb)
         self.text.window_create('end', window=e)
         self.text.insert('end', '\n') # Forces one checkbox per line
     
     # Insert help message
     self.text.insert('end', self.__doc__)
     
     # This MUST follow insertion and positioning of
     # the checkboxes/entries
     self.text.config(state = DISABLED)
开发者ID:kmdouglass,项目名称:bstore,代码行数:37,代码来源:_createdatastore.py

示例15: __init__

    def __init__(self):
        self.action = None
        self.root = root = Tk()
        root.title('Never gonna fold you up')
        root.protocol("WM_DELETE_WINDOW", self.close)

        root.pack_propagate(True)

        scrollbar = Scrollbar(root, orient=tkinter.VERTICAL)
        self.problem_list = Listbox(root, exportselection=False, yscrollcommand=scrollbar.set)
        self.problem_list.pack(expand=True, fill=tkinter.BOTH, side=tkinter.LEFT)
        scrollbar.config(command=self.problem_list.yview)
        scrollbar.pack(side=tkinter.LEFT, fill=tkinter.Y)
        self.problem_list.bind('<<ListboxSelect>>', lambda evt: self.populate_problem_canvas())

        self.problem_canvas = Canvas(root, bd=1, relief=tkinter.SUNKEN, width=500, height=500)
        self.problem_canvas.pack(expand=True, fill=tkinter.BOTH, side=tkinter.LEFT)
        self.problem_canvas.bind("<Configure>", lambda evt: self.populate_problem_canvas())

        button_frame = Frame(root)
        button_frame.pack(fill=tkinter.Y, side=tkinter.LEFT)

        # Reposition the figure so it's center of mass is at 0.5, 0.5
        v = IntVar()
        self.center_cb = Checkbutton(button_frame, text="center", variable=v, command=lambda: self.populate_problem_canvas())
        self.center_cb.var = v
        self.center_cb.pack(side=tkinter.TOP)

        # Use meshes.reconstruct_facets instead of polygon/hole logic.
        v = IntVar()
        self.reconstruct_cb = Checkbutton(button_frame, text="reconstruct", variable=v, command=lambda: self.populate_problem_canvas())
        self.reconstruct_cb.var = v
        self.reconstruct_cb.pack(side=tkinter.TOP)

        self.populate_problems()
        self.current_problem_name = None
        self.current_problem = None
开发者ID:Vlad-Shcherbina,项目名称:icfpc2016-tbd,代码行数:37,代码来源:tkrender.py


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