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


Python Checkbutton.grid方法代码示例

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


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

示例1: ConfigWindow

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
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,代码行数:31,代码来源:pysenku-0.5.py

示例2: PasswordDialog

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
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,代码行数:30,代码来源:password_dialog.py

示例3: __init__

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
    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,代码行数:32,代码来源:preferences.py

示例4: openfile

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
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,代码行数:53,代码来源:Gui.py

示例5: __init__

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
 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,代码行数:46,代码来源:viewer_generator.py

示例6: __init__

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
 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,代码行数:45,代码来源:dice.py

示例7: __init__

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
    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,代码行数:58,代码来源:grid-layout.py

示例8: MLNQueryGUI

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
class MLNQueryGUI(object):
    def __init__(self, master, gconf, directory=None):
        self.master = master

        self.initialized = False

        self.master.bind('<Return>', self.infer)
        self.master.bind('<Escape>', lambda a: self.master.quit())
        self.master.protocol('WM_DELETE_WINDOW', self.quit)

        self.dir = os.path.abspath(ifnone(directory, ifnone(gconf['prev_query_path'], os.getcwd())))

        self.frame = Frame(master)
        self.frame.pack(fill=BOTH, expand=1)
        self.frame.columnconfigure(1, weight=1)

        row = 0
        # pracmln project options
        Label(self.frame, text='PRACMLN Project: ').grid(row=row, column=0,
                                                         sticky='ES')
        project_container = Frame(self.frame)
        project_container.grid(row=row, column=1, sticky="NEWS")

        # new proj file
        self.btn_newproj = Button(project_container, text='New Project...', command=self.new_project)
        self.btn_newproj.grid(row=0, column=1, sticky="WS")

        # open proj file
        self.btn_openproj = Button(project_container, text='Open Project...', command=self.ask_load_project)
        self.btn_openproj.grid(row=0, column=2, sticky="WS")

        # save proj file
        self.btn_updateproj = Button(project_container, text='Save Project...', command=self.noask_save_project)
        self.btn_updateproj.grid(row=0, column=3, sticky="WS")

        # save proj file as...
        self.btn_saveproj = Button(project_container, text='Save Project as...', command=self.ask_save_project)
        self.btn_saveproj.grid(row=0, column=4, sticky="WS")

        # grammar selection
        row += 1
        Label(self.frame, text='Grammar: ').grid(row=row, column=0, sticky='E')
        grammars = ['StandardGrammar', 'PRACGrammar']
        self.selected_grammar = StringVar()
        self.selected_grammar.trace('w', self.settings_setdirty)
        l = OptionMenu(*(self.frame, self.selected_grammar) + tuple(grammars))
        l.grid(row=row, column=1, sticky='NWE')

        # logic selection
        row += 1
        Label(self.frame, text='Logic: ').grid(row=row, column=0, sticky='E')
        logics = ['FirstOrderLogic', 'FuzzyLogic']
        self.selected_logic = StringVar()
        self.selected_logic.trace('w', self.settings_setdirty)
        l = OptionMenu(*(self.frame, self.selected_logic) + tuple(logics))
        l.grid(row=row, column=1, sticky='NWE')

        # mln section
        row += 1
        Label(self.frame, text="MLN: ").grid(row=row, column=0, sticky='NE')
        self.mln_container = FileEditBar(self.frame, directory=self.dir,
                                         filesettings={'extension': '.mln', 'ftypes': [('MLN files', '.mln')]},
                                         defaultname='*unknown{}',
                                         importhook=self.import_mln,
                                         deletehook=self.delete_mln,
                                         projecthook=self.save_proj,
                                         filecontenthook=self.mlnfilecontent,
                                         fileslisthook=self.mlnfiles,
                                         updatehook=self.update_mln,
                                         onchangehook=self.project_setdirty)
        self.mln_container.editor.bind("<FocusIn>", self._got_focus)
        self.mln_container.grid(row=row, column=1, sticky="NEWS")
        self.mln_container.columnconfigure(1, weight=2)
        self.frame.rowconfigure(row, weight=1)

        row += 1
        self.use_emln = IntVar()
        self.use_emln.set(0)
        self.cb_use_emln = Checkbutton(self.frame, text="use model extension",
                                       variable=self.use_emln,
                                       command=self.onchange_use_emln)
        self.cb_use_emln.grid(row=row, column=1, sticky="W")

        # mln extension section
        row += 1
        self.emlncontainerrow = row
        self.emln_label = Label(self.frame, text="EMLN: ")
        self.emln_label.grid(row=self.emlncontainerrow, column=0, sticky='NE')
        self.emln_container = FileEditBar(self.frame,
                                          directory=self.dir,
                                          filesettings={'extension': '.emln', 'ftypes': [('MLN extension files','.emln')]},
                                          defaultname='*unknown{}',
                                          importhook=self.import_emln,
                                          deletehook=self.delete_emln,
                                          projecthook=self.save_proj,
                                          filecontenthook=self.emlnfilecontent,
                                          fileslisthook=self.emlnfiles,
                                          updatehook=self.update_emln,
                                          onchangehook=self.project_setdirty)
        self.emln_container.grid(row=self.emlncontainerrow, column=1, sticky="NEWS")
#.........这里部分代码省略.........
开发者ID:bbferka,项目名称:pracmln,代码行数:103,代码来源:mlnquery.py

示例9: Application

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]

#.........这里部分代码省略.........
        self.menubar.add_command(label="Load", command= self.load)
        self.menubar.add_command(label="Help", command= self.help)
        root.config(menu= self.menubar)

    def makeInputFrame(self):
        self.inp_seed         = String()
        self.bgColor          = String()
        self.gen_value        = Int()
        self.rainbowCheck     = Int()
        self.fram_input       = Frame(self,              bd= 2, relief= self.style, width= input_frame_width, height= input_frame_height)
        self.fram_seed        = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.fram_prod        = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.fram_draw        = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.fram_drawParams  = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.fram_gen         = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.fram_output      = Frame(self.fram_input,   bd= 1, relief= self.style)
        self.menu_gen         = DropDown(self.fram_gen,  textvariable= self.gen_value, state= 'readonly')
        self.entr_seed        = Input(self.fram_seed,    textvariable= self.inp_seed)
        self.text_output      = Output(self.fram_output, width= 35, height= 10)
        self.scrl_output      = Scrollbar(self.fram_output)
        self.list_prod        = List(self.fram_prod,     selectmode= BROWSE, font= "Courier 8", height= 5)
        self.list_draw        = List(self.fram_draw,     selectmode= BROWSE, font= "Courier 8", height= 5)
        self.slid_linesize    = Slider(self.fram_drawParams,  from_= 0.1, to= 10.0,     orient= HORIZONTAL, resolution= 0.1, length= 180)
        self.slid_timer       = Slider(self.fram_drawParams,  from_= 0, to= 2,          orient= HORIZONTAL, resolution= 0.02, length= 180)
        self.slid_angle       = Slider(self.fram_drawParams,  from_= 0, to= 359,        orient= HORIZONTAL, length= 180)
        self.entr_bgcolor     = Input (self.fram_drawParams, textvariable= self.bgColor)
        self.butt_prodAdd     = Button(self.fram_prod,   text= "Add",    width=8, command= self.AddProductionRule)
        self.butt_prodEdit    = Button(self.fram_prod,   text= "Edit",   width=8, command= self.EditProductionRule)
        self.butt_prodDelete  = Button(self.fram_prod,   text= "Delete", width=8, command= self.DeleteProductionRule)
        self.butt_drawAdd     = Button(self.fram_draw,   text= "Add",    width=8, command= self.AddDrawingRule)
        self.butt_drawEdit    = Button(self.fram_draw,   text= "Edit",   width=8, command= self.EditDrawingRule)
        self.butt_drawDelete  = Button(self.fram_draw,   text= "Delete", width=8, command= self.DeleteDrawingRule)
        self.chek_incColor    = CheckBox(self.fram_draw, text= "Rainbow", variable= self.rainbowCheck)
        Label(self.fram_seed,       text= "Axiom:", width=8).grid             (row=0, column=0)
        Label(self.fram_prod,       text= "Production\nRules:", width=8).grid (row=0, column=0)
        Label(self.fram_draw,       text= "Drawing\nRules:", width=8).grid    (row=0, column=0)
        Label(self.fram_drawParams, text= "Line Size:").grid                  (row=0, column=0)
        Label(self.fram_drawParams, text= "Delay (ms):").grid                 (row=1, column=0)
        Label(self.fram_drawParams, text= "Starting Angle:").grid             (row=2, column=0)
        Label(self.fram_drawParams, text= "Background Color:").grid           (row=3, column=0)
        Label(self.fram_output,     text= "Output:").grid                     (row=0, column=0)
        Label(self.fram_gen,        text= "Generations:").grid                (row=0, column=0)

        self.gen_value.set(1)
        self.menu_gen['values'] = tuple(range(1, 13))
        self.slid_linesize.set(1.0)
        self.bgColor.set( Color.default() )
        self.text_output.config(state='disabled', yscrollcommand= self.scrl_output.set)
        self.scrl_output.config(command=self.text_output.yview)

        self.fram_input.grid      (row=0, column=0)
        self.fram_seed.grid       (row=1, column=0, sticky= 'ew')
        self.fram_prod.grid       (row=2, column=0, sticky= 'ew')
        self.fram_draw.grid       (row=3, column=0, sticky= 'ew')
        self.fram_drawParams.grid (row=4, column=0, sticky= 'ew')
        self.fram_gen.grid        (row=5, column=0, sticky= 'ew')
        self.fram_output.grid     (row=6, column=0, sticky= 'ew')
        self.entr_seed.grid       (row=0, column=1, sticky= 'ew')
        self.list_prod.grid       (row=0, column=1, sticky= 'ew')
        self.butt_prodAdd.grid    (row=1, column=0, sticky= 'ew')
        self.butt_prodEdit.grid   (row=1, column=1, sticky= 'ew')
        self.butt_prodDelete.grid (row=1, column=2, sticky= 'ew')
        self.list_draw.grid       (row=0, column=1)
        self.butt_drawAdd.grid    (row=1, column=0, sticky= 'ew')
        self.butt_drawEdit.grid   (row=1, column=1, sticky= 'ew')
        self.butt_drawDelete.grid (row=1, column=2, sticky= 'ew')
开发者ID:edwardsCam,项目名称:Python-Scripts,代码行数:70,代码来源:LinSys.py

示例10: StringVar

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
    chapnum = StringVar()
    bookname = StringVar()

    chap_entry = ttk.Entry(mainframe, width=7, textvariable=chapnum)
    chap_entry.grid(column=2, row=1, sticky=(W, E))

    book_entry = ttk.Entry(mainframe, width=7, textvariable=bookname)
    book_entry.grid(column=2, row=2, sticky=(W, E))

    ttk.Label(mainframe, text="Chapter:").grid(column=1, row=1, sticky=E)
    ttk.Label(mainframe, text="Book:").grid(column=1, row=2, sticky=E)

    row = 2
    trigger_list = ["gore", "overt racism (non-fictional)", "ableism"]
    trigger_dict = dict()
    for t in trigger_list:
        trigger_dict[t] = IntVar()
        l = Checkbutton(root, text=t, variable=trigger_dict[t])
        l.grid(column=1, row=row, sticky=W)
        row += 1

    ttk.Button(mainframe, text="Blog, dog", command=blog_dog).grid(column=2, row=row, sticky=W)
    mainframe.bind("<Return>", blog_dog)

    for child in mainframe.winfo_children():
        child.grid_configure(padx=5, pady=5)

    chap_entry.focus()
    root.mainloop()
开发者ID:ksadwin,项目名称:iraedriapp,代码行数:31,代码来源:blogposter.py

示例11: __init__

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
class Main:
    def __init__(self, master):  # we will define everything in the UI below
        logger.info("Program start")
        self.master = master
        self.master.wm_title("Lautaloader v.1.03")  # title of window
        self.master.resizable(width=FALSE, height=FALSE)  # window is not resizable
        self.master.geometry('420x240')  # resolution of the window in pixels
        self.master.grid_propagate(False)  # window will not resize in any case

        self.r_selection = IntVar()  # these are radiobuttons and checkbuttons
        self.c1_selection = IntVar()
        self.c2_selection = IntVar()
        self.c1_selection.set(0)  # checkbuttons will be off at launch
        self.c2_selection.set(0)
        self.r_selection.set(1)  # we need one radiobutton selected at start

        self.status_text = StringVar()  # status text is visible at the bottom of GUI
        self.status_text.set('Ready to work')  # we can (and will) set the status text like this
        self.save_folder = ''  # we will save into this folder
        self.filenames = []  # this is our folder filenames list
        self.url_text = StringVar()
        self.num_pics = 0
        self.num_mp4 = 0
        self.num_mp3 = 0
        self.image_url = ''
        self.name_of_file = ''
        self.res = ''
        self.imagefile = ''
        self.filesize = ''
        self.imagewritten = False
        self.read_timeout = 1.0
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) '
            'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36',
            'Upgrade-Insecure-Requests': '1',
            'Referer': '',
            'DNT': '1',
            'Accept-Language': 'fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4',
            'Accept-Encoding': 'gzip, deflate, sdch',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
        }  # need to send some headers or server refuses connection

        self.lf = LabelFrame(master, text=' Get ')
        self.lf.grid(row=1, column=1, rowspan=4)

        self.lf2 = LabelFrame(master, text=' Options ')
        self.lf2.grid(row=1, column=2)

        self.R1 = Radiobutton(self.lf, text="All", variable=self.r_selection, value=1)
        self.R1.grid(row=1, column=1, sticky=W)

        self.R2 = Radiobutton(self.lf, text="only img", variable=self.r_selection, value=2)
        self.R2.grid(row=2, column=1, sticky=W)

        self.R3 = Radiobutton(self.lf, text="only mp4", variable=self.r_selection, value=3)
        self.R3.grid(row=3, column=1, sticky=W)

        self.R4 = Radiobutton(self.lf, text="only mp3", variable=self.r_selection, value=4)
        self.R4.grid(row=4, column=1, sticky=W)

        self.C1 = Checkbutton(self.lf2, text="Create new filenames", variable=self.c1_selection,
                              state=NORMAL, onvalue=1, offvalue=0)
        self.C1.grid(row=1, column=2, sticky=W)

        self.C2 = Checkbutton(self.lf2, text="Overwrite if found", variable=self.c2_selection,
                              state=NORMAL, onvalue=1, offvalue=0)
        self.C2.grid(row=2, column=2, sticky=W)

        self.folder_label = Label(master, text="Folder: ")
        self.folder_label.grid(row=5, sticky=E)

        self.url_label = Label(root, text="URL: ")
        self.url_label.grid(row=6, sticky=E)

        self.folder_entry = Entry(master, textvariable=self.save_folder, state="readonly", width=50)
        self.folder_entry.grid(row=5, column=1, columnspan=2)

        self.url_entry = Entry(master, textvariable=self.url_text, width=50)
        self.url_entry.grid(row=6, column=1, columnspan=2)

        self.selectbutton = Button(master, text="Select..", state=NORMAL, command=self.get_folder)
        self.selectbutton.grid(row=5, column=3, sticky=W)

        self.openfolderbutton = Button(master, text="Open folder", state=DISABLED, command=self.openfolder)
        self.openfolderbutton.grid(row=3, column=2, sticky=W, padx=22)

        self.urlbutton = Button(master, text="Download", state=DISABLED, command=self.logic)
        self.urlbutton.grid(row=6, column=3, sticky=W)

        self.status = Label(master, textvariable=self.status_text, wraplength=300)
        self.status.grid(row=9, columnspan=4, sticky=W)

        self.progressbar = Progressbar(master, orient="horizontal", length=100, mode="determinate")
        self.progressbar.grid(row=8, sticky='we', columnspan=3, pady=3)

        self.manage_config()  # process through config file

        self.url_1 = config.get('basic_config', 'url_1')
        logging.debug("url_1 set to %s" % self.url_1)
        self.url_2 = config.get('basic_config', 'url_2')
#.........这里部分代码省略.........
开发者ID:lautaloader,项目名称:lloader,代码行数:103,代码来源:lautaloader103.py

示例12: createWidgets

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
    def createWidgets(self):
        '''Create and align widgets'''

        top = self.winfo_toplevel()
        top.rowconfigure(0, weight=1)
        top.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.passwordout = StringVar()
        self.passwordout.set('- No password generated -')
        self.isnew = IntVar()

        ttitle = Label(self, text=versionStr, font=self.getFont(4))
        wisnew = Checkbutton(self, height=2, font=self.getFont(),
                             text=('This is a new password, that I have not '
                                   'used before'),
                             variable=self.isnew, command=self.toggleCheck)
        tlabel = Label(self, text='Label', font=self.getFont(2))
        tpasswordin1 = Label(self, text='Password', font=self.getFont(2))
        tpasswordin2 = Label(self, text='Password (again)',
                             font=self.getFont(2))
        tlength = Label(self, text='Length', font=self.getFont(2))
        talgorithm = Label(self, text='Algorithm', font=self.getFont(2))
        tsequence = Label(self, text='Sequence #', font=self.getFont(2))
        self.label = ttk.Combobox(self, width=27, font=self.getFont(),
                                  postcommand=self.filterLabels)
        self.passwordin1 = Entry(self, width=27, font=self.getFont(), show="*")
        self.passwordin2 = Entry(self, width=27, font=self.getFont(), show="*",
                                 state=DISABLED)
        length = Spinbox(self, width=3, font=self.getFont, from_=9,
                         to=171, textvariable=self.lengthVar)
        self.algorithm = ttk.Combobox(self, width=27, font=self.getFont(),
                                      values=algos.algorithms)
        sequence = Spinbox(self, width=3, font=self.getFont, from_=1,
                           to=sys.maxsize, textvariable=self.sequenceVar)
        genbutton = Button(self, text="Generate password",
                           font=self.getFont(), command=self.validateAndShow,
                           default="active")
        clrbutton = Button(self, text="Clear fields", font=self.getFont(),
                           command=self.clearIO)
        self.result = Entry(self, font=self.getFont(4),
                            textvariable=self.passwordout, state="readonly",
                            fg="black", readonlybackground="gray")

        # Keybindings
        self.passwordin1.bind('<Return>', lambda e: genbutton.invoke())
        self.passwordin2.bind('<Return>', lambda e: genbutton.invoke())
        length.bind('<Return>', lambda e: genbutton.invoke())
        self.algorithm.bind('<Return>', lambda e: genbutton.invoke())
        sequence.bind('<Return>', lambda e: genbutton.invoke())
        self.master.bind('<Control-q>', lambda e: self.quit())
        self.master.bind('<Escape>', lambda e: self.reset())
        self.label.bind('<<ComboboxSelected>>', self.labelSelected)
        self.label.bind('<FocusOut>', self.labelFocusOut)

        # Layout widgets in a grid
        ttitle.grid(row=0, column=0, sticky=N + S + E + W, columnspan=2)
        wisnew.grid(row=1, column=0, sticky=N + S + E + W, columnspan=2)

        tlabel.grid(row=2, column=0, sticky=N + S + W)
        self.label.grid(row=2, column=1, sticky=N + S + E + W)

        tpasswordin1.grid(row=3, column=0, sticky=N + S + W)
        self.passwordin1.grid(row=3, column=1, sticky=N + S + E + W)

        tpasswordin2.grid(row=4, column=0, sticky=N + S + W)
        self.passwordin2.grid(row=4, column=1, sticky=N + S + E + W)

        tlength.grid(row=5, column=0, sticky=N + S + W)
        length.grid(row=5, column=1, sticky=N + S + E + W)

        talgorithm.grid(row=6, column=0, sticky=N + S + W)
        self.algorithm.grid(row=6, column=1, sticky=N + S + E + W)

        tsequence.grid(row=7, column=0, sticky=N + S + W)
        sequence.grid(row=7, column=1, sticky=N + S + E + W)

        clrbutton.grid(row=8, column=0, sticky=N + S + E + W, columnspan=2)
        genbutton.grid(row=9, column=0, sticky=N + S + E + W, columnspan=2)
        self.result.grid(row=10, column=0, sticky=N + S + E + W, columnspan=2)

        # Initial values
        self.algorithm.set(self.settings.algorithm)

        # Initially, set focus on self.label
        self.label.focus_set()
开发者ID:babab,项目名称:DisPass,代码行数:89,代码来源:gui.py

示例13: Application

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.bind((host, port))
        self.grid()
        self.columnconfigure(0, minsize=100)
        self.columnconfigure(1, minsize=200)
        self.columnconfigure(2, minsize=200)
        self.columnconfigure(3, minsize=150)
        self.columnconfigure(4, minsize=150)
        self.columnconfigure(5, minsize=150)
        self.columnconfigure(6, minsize=150)
        self.create_widgets()
        self.settables = self.assemble_settables()
        self.gui_logger = logging.getLogger('gui')
        self.request_update()

    def create_widgets(self):
        self.create_monitor()
        self.create_check_buttons()
        self.create_ranges()
        self.create_scales()
        self.create_radio_buttons()
        self.create_voices()
        self.quitButton = Button(self, text='Quit', command=self.quit)
        self.quitButton.grid(columnspan=7, sticky=E + W)

    def assemble_settables(self):
        settables = self.winfo_children()
        for w in settables:
            settables += w.winfo_children()
        return [w for w in settables if w.__class__.__name__ in ['Scale', 'Checkbutton']]

    def create_radio_buttons(self):
        # Scale related
        entries = ['DIATONIC', 'HARMONIC', 'MELODIC', 'PENTATONIC', 'PENTA_MINOR',
                   'GREEK_CHROMATIC', 'GREEK_ENHARMONIC']
        self.scale = StringVar()
        self.scale.set('DIATONIC')
        self.rb_frame = Frame(self)
        for e in entries:
            rb = Radiobutton(self.rb_frame, value=e, text=e, anchor=W,
                             command=self.send_scale, variable=self.scale)
            rb.grid(row=len(self.rb_frame.winfo_children()), sticky=W)
        self.rb_frame.grid(column=1, row=len(self.grid_slaves(column=1)), rowspan=3)

    def create_monitor(self):
        self.monitor_frame = LabelFrame(self, text="Monitor and Transport")
        this_cycle = Scale(self.monitor_frame, label='cycle_pos', orient=HORIZONTAL,
                           from_=1, to=16, resolution=1)
        this_cycle.disable, this_cycle.enable = (None, None)
        this_cycle.ref = 'cycle_pos'
        this_cycle.grid(column=0, row=0, sticky=E + W)
        self.updateButton = Button(self.monitor_frame,
                                   text='Reload all Settings',
                                   command=self.request_update)
        self.updateButton.grid(row=1, sticky=E + W)
        self.ForceCaesuraButton = Button(self.monitor_frame,
                                         text='Force Caesura',
                                         command=self.force_caesura)
        self.ForceCaesuraButton.grid(row=2, sticky=E + W)
        self.saveBehaviourButton = Button(self.monitor_frame,
                                          text='Save current behaviour',
                                          command=self.request_saving_behaviour)
        self.saveBehaviourButton.grid(row=3, sticky=E + W)
        self.saveBehaviourNameEntry = Entry(self.monitor_frame)
        self.saveBehaviourNameEntry.grid(row=4, sticky=E + W)
        self.saveBehaviourNameEntry.bind('<KeyRelease>', self.request_saving_behaviour)
        self.selected_behaviour = StringVar()
        self.selected_behaviour.trace('w', self.new_behaviour_chosen)
        self.savedBehavioursMenu = OptionMenu(self.monitor_frame,
                                              self.selected_behaviour, None,)
        self.savedBehavioursMenu.grid(row=5, sticky=E + W)
        self.monitor_frame.grid(column=0, row=10, sticky=E + W)

    def request_update(self):
        self.send({'sys': 'update'})

    def request_saving_behaviour(self, event=None):
        """callback for save behaviour button and textentry"""
        if event and event.widget == self.saveBehaviourNameEntry:
            if event.keysym == 'Return':
                name = self.saveBehaviourNameEntry.get()
                self.saveBehaviourNameEntry.delete(0, len(name))
            else:
                return
        else:  # button was pressed
            name = self.saveBehaviourNameEntry.get()
        if name:
            self.send({'sys': ['save_behaviour', name]})

    def force_caesura(self):
        self.send({'force_caesura': True})

    def create_voices(self):
        voice_ids = ['1', '2', '3', '4']
        SCALES = OrderedDict([
                  ('pan_pos', {'min': -1, 'max': 1, 'start': 0.5, 'res': 0.001}),
#.........这里部分代码省略.........
开发者ID:kr1,项目名称:roqba,代码行数:103,代码来源:main.py

示例14: initUI

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
    def initUI( self ):

        #pack framework
        self.pack( fill=BOTH, expand=1 )

        #setting font
        FONT = ('serif', 10)

        #setting UI grid
        self.columnconfigure(0, weight=1)
        self.columnconfigure(2, pad=10)
        self.rowconfigure(6, pad=200, weight=1)

        #setting widgets

        #Label
        available_lb = Label( self, text='Availabel sessions:', font=FONT )
        available_lb.grid( row=0, column=0, sticky=W )

        #list
        y_scroll = Scrollbar( self, orient=VERTICAL )
        y_scroll.grid( row=1, column=1, rowspan=9, sticky=N+S )

        self.script_list = Listbox( self, bg='white', font=FONT, selectmode=SINGLE,
            yscrollcommand=y_scroll.set )
        self.script_list.grid( row=1, column=0, rowspan=9, sticky=W+E+N+S )

        #button
        exec_btn = Button( self, text='Execute', width=6, font=FONT, 
            command=self.execute )
        exec_btn.grid( row=1, column=2 )

        copy_btn = Button( self, text='Copy', width=6, font=FONT, 
            command=self.copyCheck )
        copy_btn.grid( row=3, column=2 )

        create_btn = Button( self, text='Create', width=6, font=FONT, 
            command=lambda:self.popWidget( self.createFile ) )
        create_btn.grid( row=2, column=2 )

        edit_btn = Button( self, text='Edit', width=6, font=FONT, command=self.editFile )
        edit_btn.grid( row=4, column=2 )

        delete_btn = Button( self, text='Delete', width=6, font=FONT, 
            command=self.deleteFile )
        delete_btn.grid( row=5, column=2 )

        help_btn = Button( self, text='Help', width=6, font=FONT, command=self.usageHelp )
        help_btn.grid( row=7, column=3, sticky=E )

        abt_btn = Button( self, text='About', width=6, font=FONT, command=self.about )
        abt_btn.grid( row=8, column=3, sticky=E )

        quit_btn = Button( self, text='Quit', width=6, font=FONT, command=self.quit )
        quit_btn.grid( row=9, column=3, sticky=E )

        #Option
        lbl2 = Label( self, text='Exeuction Options:' )
        lbl2.grid( row=0, column=3, sticky=W )

        execute_with_term = Checkbutton( self, text='Execute with terminal',
            variable=self.opt_exec_with_term )
        execute_with_term.grid( row=1, column=3, sticky=E )
开发者ID:milksleisure,项目名称:Milk-Command-Cacher,代码行数:65,代码来源:CommandCacher.py

示例15: GraphicalUserInterface

# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import grid [as 别名]
class GraphicalUserInterface(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.__initUI()

    def __initUI(self):
        self.parent.title("Fuel Manager")

        # parameters that the user can modify
        self.__exchvar = BooleanVar()
        self.__exchrate = True
        self.__datevar = BooleanVar()
        self.__datetime = True
        self.__empty_tank_var = BooleanVar()
        self.__empty_tank = False
        self.__airport_file = "input files/airport.csv"
        self.__aircraft_file = "input files/aircraft.csv"
        self.__currency_file = "input files/countrycurrency.csv"
        self.__exchange_rate_file = "input files/currencyrates.csv"
        self.__itinerary_file = "input files/testroutes.csv"
        self.__output_file = "bestroutes/bestroutes.csv"
        self.__home_airport = ["DUB"]
        self.__other_airports = ["LHR", "CDG", "JFK", "AAL", "AMS", "ORK"]
        self.__hubs = ["MHP"]
        self.__stopover_cost = 0
        self.__constraints = "JFK AAL / JFK CDG"
        self.__aircraft_code = "747"

        # main frame
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=True)
        self.pack(fill=BOTH, expand=True)

        # manage single itinerary frame
        self.manual_frame = LabelFrame(self, text="Manage a single itinerary", font=("Helvetica", 14), width=300)
        self.manual_frame.place(x=50, y=50)

        # Empty row to put some space between the other rows and to control the width of this frame because
        # I don't know what I'm doing
        self.empty_label = Label(self.manual_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=0, sticky="W")

        # Text field where user can enter home airport
        self.home_airport_label = Label(self.manual_frame, width=22, text="Home airport:", anchor='w')
        self.home_airport_label.grid(row=1, sticky="W")
        self.home_airport_entry = Entry(self.manual_frame, width=50)
        self.home_airport_entry.grid(row=2, sticky="E")
        self.home_airport_entry.insert(0, self.__home_airport)

        self.empty_label = Label(self.manual_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=3, sticky="W")

        # Text field where user can enter other airports
        self.other_airports_label = Label(self.manual_frame, width=22, text="Other airports:", anchor='w')
        self.other_airports_label.grid(row=4, sticky="W")
        self.other_airports_entry = Entry(self.manual_frame, width=50)
        self.other_airports_entry.grid(row=5, sticky="E")
        self.other_airports_entry.insert(0, self.__other_airports)

        self.empty_label = Label(self.manual_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=6, sticky="W")

        # Text field where user can enter aircraft code
        self.aircraft_label = Label(self.manual_frame, width=22, text="Aircraft code:", anchor='w')
        self.aircraft_label.grid(row=7, sticky="W")
        self.aircraft_entry = Entry(self.manual_frame, width=50)
        self.aircraft_entry.grid(row=8, sticky="E")
        self.aircraft_entry.insert(0, self.__aircraft_code)

        self.empty_label = Label(self.manual_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=9, sticky="W")

        # Text field where user can enter constraints
        self.constraints_label = Label(self.manual_frame, width=22, text="Constraints:", anchor='w')
        self.constraints_label.grid(row=13, sticky="W")
        self.constraints_entry = Entry(self.manual_frame, width=50)
        self.constraints_entry.grid(row=14, sticky="E")
        self.constraints_entry.insert(0, self.__constraints)
        self.constraints_explanation_label = \
            Label(self.manual_frame, width=50,
                  text="Each constraint should consist of three-letter airport codes"
                       "\nseparated by spaces. To enter more than one constraint,"
                       "\nuse ' / ' to separate them", anchor='w', justify='left')
        self.constraints_explanation_label.grid(row=15, sticky="W")

        self.empty_label = Label(self.manual_frame, text=" ", width=60, height=1, font=("Helvetica", 1))
        self.empty_label.grid(row=16, sticky="W")

        # run button
        self.run_button = Button(self.manual_frame, text='Manage itinerary', command=self.__manage_single_itinerary,
                                 bg="#CCE1E8")
        self.run_button.grid(row=16, sticky="E")

        # manage list of itineraries frame
        self.itinerary_list_frame = LabelFrame(self, text="Manage a list of itineraries",
                                               font=("Helvetica", 14), width=300)
        self.itinerary_list_frame.place(x=50, y=375)

        # Empty row to put some space between the other rows and to control the width of this frame
#.........这里部分代码省略.........
开发者ID:shanecroberts,项目名称:FuelManager,代码行数:103,代码来源:FuelManager.py


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