def startwindow(self):

        self.var1 = IntVar()
        self.textvar = StringVar()

        self.Label1 = Label(self.master, text="Search distance (meters)")
        self.Label1.grid(row=0, column=0)

        self.Label2 = Label(self.master, textvariable=self.textvar)
        self.Label2.grid(row=2, column=0)

        self.rb1 = Radiobutton(self.master,
                               text="5000",
                               variable=self.var1,
                               value=5000,
                               command=self.cb1select)
        self.rb1.grid(row=1, column=0, sticky=W)

        self.rb2 = Radiobutton(self.master,
                               text="625",
                               variable=self.var1,
                               value=625,
                               command=self.cb1select)
        self.rb2.grid(row=1, column=1, sticky=W)

        self.rb3 = Radiobutton(self.master,
                               text="160",
                               variable=self.var1,
                               value=160,
                               command=self.cb1select)
        self.rb3.grid(row=1, column=2, sticky=W)

        self.Button1 = Button(self.master, text="ok", command=self.ButtonClick)
        self.Button1.grid(row=2, column=2)
Example #2
0
def init():
    """初始化页面"""
    global face_file_list, face_image, face_label, detect_label

    all_files = os.listdir(image_dir)
    face_file_list = filter(lambda x: x.endswith('jpg'), all_files)
    get_face_record(offset)


    place_image(offset)
    face_image = Label(master, image=tk_image)
    face_image.place(anchor=u'nw', x=10, y=40)

    face_label = IntVar()
    face_label.set(face_record.label)
    score_ugly = Radiobutton(master, text=u'丑', variable=face_label,
                             value=0, command=set_face_label)
    score_ugly.place(anchor=u'nw', x=120, y=10)
    score_normal = Radiobutton(master, text=u'一般', variable=face_label,
                               value=1, command=set_face_label)
    score_normal.place(anchor=u'nw', x=160, y=10)
    score_pretty = Radiobutton(master, text=u'漂亮', variable=face_label,
                               value=2, command=set_face_label)
    score_pretty.place(anchor=u'nw', x=220, y=10)

    detect_label = Label(master, text=u'')
    detect_label.place(anchor=u'nw', x=580, y=10)

    handle_detect()
Example #3
0
    def initialize_controls(self, rest=False):
        label_text = StringVar()
        label_text.set("It is a %s's turn" % self.player.name)
        self.board.canvas.bind('<Button-1>', self.move)

        self.label = Label(self.board.container, textvariable=label_text)
        self.level1 = Radiobutton(self.board.container,
                                  text="Easy",
                                  variable=self.level_var,
                                  value=1,
                                  command=self.update_level)
        self.level2 = Radiobutton(self.board.container,
                                  text="Medium",
                                  variable=self.level_var,
                                  value=2,
                                  command=self.update_level)
        self.level3 = Radiobutton(self.board.container,
                                  text="Hard",
                                  variable=self.level_var,
                                  value=3,
                                  command=self.update_level)
        self.reset_button = Button(self.board.container,
                                   text="Reset",
                                   width=25,
                                   command=self.restart)
Example #4
0
    def options(self):
        """
        Create radio buttons for accepting user input.

        Radiobutton Yes is created for user to re-enter netlist
        Radiobutton No is created for user to quit.
        """
        self.v = StringVar()
        Label(self.root, text=self.err_msg).grid(row=0,
                                                 column=0,
                                                 sticky='news')
        Radiobutton(self.root,
                    text="Yes",
                    variable=self.v,
                    value="Yes",
                    command=self.close).grid(row=1,
                                             column=0,
                                             sticky=tk.W,
                                             pady=4)
        Radiobutton(self.root,
                    text="No",
                    variable=self.v,
                    value="No",
                    command=self.close).grid(row=2,
                                             column=0,
                                             sticky=tk.W,
                                             pady=4)
Example #5
0
    def displayoptions(self):
        """
        Function displays the different options that are given to the user.

        - If the transfer function is constant it is displayed in the terminal
          and the window closes.

        - If the transfer function is not constant three different options
          are provided to the user.

            - time-domain response for which function step is called

            - Bode plot for which function bode is called

            - Nyquist plot for which function nyq is called

        Radio buttons are the input method for the user.
        """
        self.sys = control.tf(self.n, self.d)
        print("The transfer function of the system is: ")
        print(self.sys)
        if len(self.n) == 1 and len(self.d) == 1:
            print("Transfer function constant. Bye!!")
            self.close()
        else:
            self.v = StringVar()
            Radiobutton(self.root,
                        text="Step Response",
                        variable=self.v,
                        value="step",
                        command=self.step).grid(row=3,
                                                column=0,
                                                sticky=tk.W,
                                                pady=4)
            Radiobutton(self.root,
                        text="Bode Plot",
                        variable=self.v,
                        value="bode",
                        command=self.bode).grid(row=5,
                                                column=0,
                                                sticky=tk.W,
                                                pady=4)
            Radiobutton(self.root,
                        text="Nyquist Plot",
                        variable=self.v,
                        value="nyquist",
                        command=self.nyq).grid(row=7,
                                               column=0,
                                               sticky=tk.W,
                                               pady=4)
            Button(self.root, text='Exit',
                   command=self.close).grid(row=10,
                                            column=2,
                                            sticky=tk.W,
                                            pady=4)
Example #6
0
    def interface_parametres(self, root):
        """!Création de l'interface de choix des logiciels de visualisation
        On permet à l'utilisateur de choisir Gmsh/Xmgrace ou Salome
        """

        main_param = Frame(root)
        main_param.rowconfigure(1, weight=1)
        main_param.columnconfigure(0, weight=1)

        f = Frame(main_param, relief='sunken', borderwidth=1)
        # les parametres vont dans 'f'
        logiciels_frame = Frame(f, borderwidth=4)

        label_parametres_salome = Label(
            logiciels_frame, text=u"Paramètres Salome")
        label_parametres_salome.grid(row=2, column=1, columnspan=2)
        self.salome_widgets.append(label_parametres_salome)

        label_port = Label(logiciels_frame, text=u"Port")
        label_port.grid(row=3, column=1, sticky='w')
        self.salome_widgets.append(label_port)

        entry_salome_port = Entry(
            logiciels_frame, textvariable=self.salome_port)
        entry_salome_port.grid(row=3, column=2)
        self.salome_widgets.append(entry_salome_port)
        self.salome_port.set(self.get_runnig_salome_port())
        self.ce_salome = None

        liste_etudes = StudyList(
            logiciels_frame, self, u"choix de l'étude Salomé")
        liste_etudes.grid(row=4, column=2, sticky='w')
        self.salome_widgets.append(liste_etudes.liste)
        self.salome_widgets.append(liste_etudes.titre)
        liste_etudes.actualiser()

        label_choix_logiciel = Label(
            logiciels_frame, text=u"Choix du logiciel")
        label_choix_logiciel.grid(row=0, column=0, columnspan=3)
        button_gmsh = Radiobutton(
            logiciels_frame, text=u"Gmsh/Xmgrace", value="Gmsh/Xmgrace", variable=self.logiciel,
                                  command=self.desactivate_salome_widgets)
        button_gmsh.grid(row=1, column=0, sticky='w')

        button_salome = Radiobutton(
            logiciels_frame, text=u"Salomé", value="Salome", variable=self.logiciel,
            command=self.activate_salome_widgets)
        button_salome.grid(row=2, column=0, rowspan=3, sticky='w')

        self.logiciel.set("Salome")

        logiciels_frame.grid(row=1)

        f.grid(row=1, sticky='w' + 'e' + 's' + 'n')
        return main_param
Example #7
0
 def __init__(self):
     self.root = Tk()
     self.input_type = Tkinter.IntVar()
     self.input_type.set(1)
     self.normalize_data = Tkinter.IntVar()
     self.normalize_data.set(1)
     self.root.title("Code energy calculator")
     self.left_frame = LabelFrame(self.root, text="Input and output")
     self.left_frame.pack(side=Tkinter.LEFT,
                          fill=Tkinter.BOTH,
                          expand=True,
                          padx=(10, 5),
                          pady=10)
     self.right_frame = LabelFrame(self.root, text="Code")
     self.right_frame.pack(side=Tkinter.RIGHT,
                           fill=Tkinter.BOTH,
                           expand=True,
                           padx=(5, 10),
                           pady=10)
     code_hscroll = Scrollbar(self.right_frame, orient=Tkinter.HORIZONTAL)
     code_hscroll.pack(side=Tkinter.BOTTOM, fill=Tkinter.X)
     code_vscroll = Scrollbar(self.right_frame)
     code_vscroll.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
     self.code_text = Text(self.right_frame,
                           wrap=Tkinter.NONE,
                           xscrollcommand=code_hscroll.set,
                           yscrollcommand=code_vscroll.set)
     self.code_text.pack()
     self.code_text.insert(Tkinter.INSERT, DEFAULT_CODE)
     code_hscroll.config(command=self.code_text.xview)
     code_vscroll.config(command=self.code_text.yview)
     self.input_file_entry =\
         self.create_and_add_file_field(self.left_frame, "Input file", 5, False)
     self.spherical_coord_option =\
         Radiobutton(self.left_frame, text="Spherical coordinates",
                     variable=self.input_type, value=1)
     self.spherical_coord_option.pack(anchor=Tkinter.W)
     self.cartesian_coord_option =\
         Radiobutton(self.left_frame, text="Cartesian coordinates",
                     variable=self.input_type, value=2)
     self.cartesian_coord_option.pack(anchor=Tkinter.W)
     self.spherical_coord_option.select()
     self.output_file_entry =\
         self.create_and_add_file_field(self.left_frame, "Output file", 5, True)
     self.normalize_check = Checkbutton(self.left_frame,
                                        text="Normalize data",
                                        variable=self.normalize_data,
                                        offvalue=0,
                                        onvalue=1)
     self.normalize_check.pack()
     self.normalize_check.deselect()
     self.do_button = Button(self.left_frame, text="Run", command=self.run)
     self.do_button.pack(side=Tkinter.BOTTOM, pady=(0, 10))
Example #8
0
    def setupView(self, title="Test Auth Page", user='', pwd_ori=''):
        self.mode = IntVar()
        self.mode.set(1)
        Label(self, width=25).grid(row=1, column=0, columnspan=2)
        self.errLog = Label(self, text="")
        self.errLog.grid(row=4,
                         column=1,
                         columnspan=3,
                         rowspan=3,
                         sticky="NWSE")
        self.userVar = StringVar()
        self.pwdVar = StringVar()
        Label(self, text="Account").grid(row=2, column=1, sticky='E')
        self.userInput = Entry(self, textvariable=self.userVar, width="30")
        self.userInput.grid(row=2, column=2, columnspan=2, sticky="W")
        Label(self, text="Password").grid(row=3, column=1, sticky='E')
        self.pwdInput = Entry(self,
                              textvariable=self.pwdVar,
                              show="*",
                              width="30")
        self.pwdInput.grid(row=3, column=2, columnspan=2, sticky="W")
        self.userVar.set(user)
        self.pwdVar.set(pwd_ori)
        Label(self, text='    Welcome to fxos flash tool',
              font=TITLE_FONT).grid(row=0, column=1, columnspan=3, sticky="WE")
        Radiobutton(self,
                    state='disabled',
                    text='Download build from pvt',
                    variable=self.mode,
                    value=1,
                    command=lambda: self.entryToggle(
                        True, [self.userInput, self.pwdInput])).grid(
                            row=1, column=2, columnspan=2, sticky="E")
        Radiobutton(self,
                    state='disabled',
                    text='Flash build from local',
                    variable=self.mode,
                    value=2,
                    command=lambda: self.entryToggle(
                        False, [self.userInput, self.pwdInput])).grid(
                            row=1, column=4, sticky="W")

        self.ok = Button(self,
                         text='Next',
                         command=lambda: self.confirm(self.mode.get(
                         ), self.userVar.get(), self.pwdVar.get()))
        self.ok.grid(row=4, column=4, sticky="W")
        self.userInput.bind('<Return>', self.pressReturnKey)
        self.pwdInput.bind('<Return>', self.pressReturnKey)
        self.ok.bind('<Return>', self.pressReturnKey)
    def create_other_buttons(self):
        f = self.make_frame("Direction")

        btn = Radiobutton(f, variable=self.engine.backvar, value=1, text="Up")
        btn.pack(side="left")
        if self.engine.isback():
            btn.invoke()

        btn = Radiobutton(f,
                          variable=self.engine.backvar,
                          value=0,
                          text="Down")
        btn.pack(side="left")
        if not self.engine.isback():
            btn.invoke()
Example #10
0
        def __init__(self, name, select_command, tab_row, tab_set):
            """Constructor arguments:

            name -- The tab's name, which will appear in its button.

            select_command -- The command to be called upon selection of the
            tab. It is called with the tab's name as an argument.

            """
            Frame.__init__(self, tab_row, borderwidth=self.bw, relief=RAISED)

            self.name = name
            self.select_command = select_command
            self.tab_set = tab_set
            self.is_last_in_row = False

            self.button = Radiobutton(self,
                                      text=name,
                                      command=self._select_event,
                                      padx=5,
                                      pady=1,
                                      takefocus=FALSE,
                                      indicatoron=FALSE,
                                      highlightthickness=0,
                                      selectcolor='',
                                      borderwidth=0)
            self.button.pack(side=LEFT, fill=X, expand=True)

            self._init_masks()
            self.set_normal()
    def time(self):
        from Tkinter import LabelFrame
        time_frame = LabelFrame(self.root,
                                height=100,
                                width=150,
                                text="Time settings")
        time_frame.grid(column=1, row=0, columnspan=1, rowspan=1)

        from Tkinter import Radiobutton
        time_now = Radiobutton(time_frame, text="Now", variable=time, value=1)
        time_now.grid(column=0, row=0, columnspan=1, rowspan=1)
        time_selection = Radiobutton(time_frame,
                                     text="Select",
                                     variable=time,
                                     value=2)
        time_selection.grid(column=0, row=1, columnspan=1, rowspan=1)
Example #12
0
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.observers = []

        self.CLASS_NAME = [
            'Class {0}'.format(i + 1) for i in range(MAX_NUMBER_OF_CLASSES)
        ]

        self.selected_class = IntVar()
        self.class_buttons = {}
        for i in range(MAX_NUMBER_OF_CLASSES):
            class_button = Radiobutton(self,
                                       text=self.CLASS_NAME[i],
                                       fg=CLASS_COLOR[i],
                                       state='disabled',
                                       variable=self.selected_class,
                                       value=i,
                                       command=self._on_sample_class_selection)
            class_button.pack(anchor='w', padx=5)
            self.class_buttons[i] = class_button

        self.label = Label(self)
        self.label.pack()

        self.class_number = DEFAULT_NUMBER_OF_CLASS
        self.samples = [[]] * MAX_NUMBER_OF_CLASSES
        self.samples_coordinates = [[]] * MAX_NUMBER_OF_CLASSES
        self.select_default_class()
Example #13
0
    def __init__(self, master):
        self.master = master
        master.title("listening window")

        self.label = Label(master, text="This is our first GUI!")
        self.label.pack()
        self.label.place(x=100, y=30)

        self.label_2 = Label(master, text="Enter the name if you see fit: ")
        self.label_2.pack()
        self.label_2.place(x=100, y=5)

        self.message = StringVar()
        self.entry = Entry(textvariable=self.message)
        self.entry.place(x=320, y=15, anchor="c")

        self.label_word = Label(master, text="Vocalize: a")
        self.label_word.pack()
        self.label_word.place(x=120, y=60)

        self.var = IntVar()
        self.var.set(0)

        self.checkRU = Radiobutton(master, value=0, variable=self.var, text="Russian")
        self.checkRU.pack()
        self.checkRU.place(x=310, y=30)

        self.checkEn = Radiobutton(master, value=1, variable=self.var, text="English")
        self.checkEn.pack()
        self.checkEn.place(x=310, y=60)

        self.start_button = Button(master, text="Start recording", width=11, command=self.greet)
        self.start_button.pack()
        self.start_button.place(x=210, y=30)

        self.close_button = Button(master, text="Close", width=11, command=master.quit)
        self.close_button.pack()
        self.close_button.place(x=210, y=60)

        self.alphabet_english = [x for x in 'abcdefghijklmnopqrstuvwxyz']
        self.alphabet_russian = [x for x in unicode('абвгдежзийклмнопрстуфхцчшщыэюя', "utf-8")]
        self.x = voice_recording

        self.close_button = Button(master, text="Redirect", width=11, command=self.redirect)
        self.close_button.pack()
        self.close_button.place(x=210, y=90)
Example #14
0
 def radiobutton4(self):
     # creating radiobutton4 for question frame
     self.q4 = Radiobutton(self.qf)
     self.q4.configure(text='D. ' + self.text4)
     self.q4.configure(font=MyFonts['Large'])
     self.q4.configure(bg=self.bgcolor, activebackground=self.bgcolor)
     self.q4.configure(variable=self.ans_input, value=4)
     self.q4.place(relx=0.10, rely=0.65)
Example #15
0
 def radiobutton1(self):
     # creating radiobuttion1 for question frame
     self.q1 = Radiobutton(self.qf)
     self.q1.configure(text='A. ' + self.text1)
     self.q1.configure(font=MyFonts['Large'])
     self.q1.configure(bg=self.bgcolor, activebackground=self.bgcolor)
     self.q1.configure(variable=self.ans_input, value=1)
     self.q1.place(relx=0.10, rely=0.20)
Example #16
0
 def radiobutton2(self):
     # creating radiobutton2 for question frame
     self.q2 = Radiobutton(self.qf)
     self.q2.configure(text='B. ' + self.text2)
     self.q2.configure(font=MyFonts['Large'])
     self.q2.configure(bg=self.bgcolor, activebackground=self.bgcolor)
     self.q2.configure(variable=self.ans_input, value=2)
     self.q2.place(relx=0.10, rely=0.35)
Example #17
0
 def radiobutton3(self):
     # creating radiobutton3 for question frame
     self.q3 = Radiobutton(self.qf)
     self.q3.configure(text='C. ' + self.text3)
     self.q3.configure(font=MyFonts['Large'])
     self.q3.configure(bg=self.bgcolor, activebackground=self.bgcolor)
     self.q3.configure(variable=self.ans_input, value=3)
     self.q3.place(relx=0.10, rely=0.50)
Example #18
0
    def __init__(self, parent):

        top = self.top = Toplevel(parent)

        Label(top, text="Pick your color").pack()

        self.v = 0

        rb1 = Radiobutton(top, text="Yellow", value=YELLOW, command=self.sari)
        rb1.pack()
        rb1.select()
        rb2 = Radiobutton(top, text="Green", value=GREEN, command=self.yesil)

        rb2.pack()
        rb2.deselect()

        b = Button(top, text="OK", command=self.ok)
        b.pack(pady=5)
Example #19
0
    def add_radio_button(self, text, index):

        maptype = self.maptypes[index]
        Radiobutton(self.radiogroup,
                    text=maptype,
                    variable=self.radiovar,
                    value=index,
                    command=lambda: self.usemap(maptype)).grid(row=0,
                                                               column=index)
Example #20
0
    def startSession(self):
        assert TkinterIsInstalled, '''
        Tkinter is not installed. 
        If you have Linux you could try using 
        "apt-get install python-tk"'''
        try:
            import nlopt
        except ImportError:
            s = '''
            To use OpenOpt multifactor analysis tool 
            you should have nlopt with its Python API installed,
            see http://openopt.org/nlopt'''
            print(s)
            showerror('OpenOpt', s)
            raw_input()
            return
        import os
        hd = os.getenv("HOME")
        self.hd = hd
        root = Tk()
        self.root = root
        from openopt import __version__ as oover
        root.wm_title(
            ' OpenOpt %s Multifactor analysis tool for experiment planning ' %
            oover)
        SessionSelectFrame = Frame(root)
        SessionSelectFrame.pack(side='top',
                                padx=230,
                                ipadx=40,
                                fill='x',
                                expand=True)
        var = StringVar()
        var.set('asdf')
        Radiobutton(SessionSelectFrame, variable = var, text = 'New', indicatoron=0, \
                    command=lambda: (SessionSelectFrame.destroy(), self.create())).pack(side = 'top', fill='x', pady=5)
        Radiobutton(SessionSelectFrame, variable = var, text = 'Load', indicatoron=0,  \
                    command=lambda:self.load(SessionSelectFrame)).pack(side = 'top', fill='x', pady=5)

        root.protocol("WM_DELETE_WINDOW", self.exit)

        root.mainloop()
        self.exit()
Example #21
0
 def __init__(self, parent):
     Frame.__init__(self, parent, borderwidth=2, relief=MYRIDGE)
     self.button = Radiobutton(self,
                               padx=5,
                               pady=5,
                               takefocus=0,
                               indicatoron=FALSE,
                               highlightthickness=0,
                               borderwidth=0,
                               selectcolor=self.cget('bg'))
     self.button.pack()
def ask_multiple_choice_question(prompt, options):
    root = Tk()
    if prompt:
        Label(root, text=prompt).pack()
    v = IntVar()
    for i, option in enumerate(options):
        Radiobutton(root, text=option, variable=v, value=i).pack(anchor="w")
    Button(text="Submit", command=root.destroy).pack()
    root.mainloop()
    if v.get() == 0: return None
    return options[v.get()]
Example #23
0
 def build_widgets(self, master, row):
     self.var = IntVar(master)
     self.init_var()
     label = Label(master, text = self.label + ':')
     label.grid(row = row, columnspan = 4, sticky = W)
     choices = self.range
     for j in range(len(choices)):
         # XXX Translatable text
         b = Radiobutton(master, text=choices[j], command = self.var_changed,
                         variable = self.var, value = j, indicatoron = 1)
         b.grid(row = row+j+1, column = 1, columnspan = 3, sticky = W)
Example #24
0
 def input_radio(self, e):
     var = StringVar(master=self.frame)
     self.master.serialized[e.name] = var.get
     var.set(e.value[0][0] if e.default is None else e.default)
     for value, text in e.value:
         w = Radiobutton(self.frame,
                         text=self.compile_text(text),
                         variable=var,
                         value=value)
         self.pack_element(w)
         self.row += 1
Example #25
0
	def __init__(self,parent,graphics):
		Frame.__init__(self)
		self.parent = parent
		self.graphics = graphics
		self.config(bg=self.graphics.mainColor)
		self.selected = ""
		self.font = tkFont.Font(family="Courier", size=12)
		#self.color = '#FFFFFF'

		#Title Label
		self.outputLabel = Label(self, text="", bg=self.graphics.mainColor)
		self.outputLabel.grid(row=0,column=0,sticky='ns',padx=6,pady=5)

		v = IntVar()

		self.b1 = Radiobutton(self, text="Cash", variable=v, value=1, bg=self.graphics.mainColor, command=lambda: self.cash())
		self.b1.grid(row=1,column=0)
		self.b2 = Radiobutton(self, text="Credit", variable=v, value=2, bg=self.graphics.mainColor, command=lambda: self.credit())
		self.b2.grid(row=1,column=1)

		#Title Label
		self.creditCardNumberLabel = Label(self, text="Credit Card Number", bg=self.graphics.mainColor)
		self.creditCardNumberLabel.grid(row=2,column=0,sticky='ns',padx=6,pady=5)

		#Manual Enter Output
		self.creditCardNumber = Entry(self,width=20)
		self.creditCardNumber.grid(row=2,column=1,sticky='ns',padx=6)

		#Title Label
		self.nameLabel = Label(self, text="Enter Name", bg=self.graphics.mainColor)
		self.nameLabel.grid(row=3,column=0,sticky='ns',padx=6,pady=5)

		#Manual Enter Output
		self.name = Entry(self,width=20)
		self.name.grid(row=3,column=1,sticky='ns',padx=6)

		self.submitButton = Button(self, text="Submit", width=15, command=lambda: self.submit())
		self.submitButton.grid(row=4,column=0)

		self.cancelButton = Button(self, text="Cancel", width=15, command=lambda: self.cancel())
		self.cancelButton.grid(row=4,column=1)
Example #26
0
    def __init__(self, parent_frame, label_text, radio_list):
        super(LabelRadio, self).__init__(parent_frame, label_text)

        self._option_default = radio_list[0]
        self._radio_var = StringVar()
        for v in radio_list:
            Radiobutton(self._label_frame,
                        variable=self._radio_var,
                        text=v,
                        value=v).pack(side=LEFT, fill=X, expand=Y)
            #Radiobutton(self._label_frame, variable=self._radio_var, value=v, text=v).pack(fill=X, expand=Y)
        self._radio_var.set(radio_list[0])
Example #27
0
    def create_other_buttons(self):
        "Fill frame with buttons tied to other options."
        f = self.make_frame("Direction")

        btn = Radiobutton(f,
                          anchor="w",
                          variable=self.engine.backvar,
                          value=1,
                          text="Up")
        btn.pack(side="left", fill="both")
        if self.engine.isback():
            btn.select()

        btn = Radiobutton(f,
                          anchor="w",
                          variable=self.engine.backvar,
                          value=0,
                          text="Down")
        btn.pack(side="left", fill="both")
        if not self.engine.isback():
            btn.select()
Example #28
0
 def __init__(self,
              parent_frame,
              radio_value_list,
              text_prefix='',
              text_suffix='',
              orientation=TOP):
     self._option_default = radio_value_list[0]
     self._radio_var = StringVar(value=radio_value_list[0])
     for v in radio_value_list:
         Radiobutton(parent_frame,
                     variable=self._radio_var,
                     text='%s%s%s' % (text_prefix, v, text_suffix),
                     value=v).pack(side=orientation, anchor=W)
Example #29
0
    def create_widgets(self):
        """Create various widges in the tkinter main window."""
        self.var = IntVar()
        self.background_label = Label(self.container, image=self.village_image)
        txt = "Select a hut to enter. You win if:\n"
        txt += "The hut is unoccupie or the occupant is a friend!"
        self.info_label = Label(self.container, text=txt, bg='yellow')

        # Create a dictionary for radio button config options.
        r_btn_config = {'variable': self.var,
                        'bg': '#A8884C',
                        'activebackground': 'yellow',
                        'image': self.hut_image,
                        'height': self.hut_height,
                        'width': self.hut_width,
                        'command': self.radio_btn_pressed}

        self.r1 = Radiobutton(self.container, r_btn_config, value=1)
        self.r2 = Radiobutton(self.container, r_btn_config, value=2)
        self.r3 = Radiobutton(self.container, r_btn_config, value=3)
        self.r4 = Radiobutton(self.container, r_btn_config, value=4)
        self.r5 = Radiobutton(self.container, r_btn_config, value=5)
Example #30
0
    def create_widgets(self):
        """构建界面"""
        self.radio_value = IntVar()

        Label(self, text="网络安全").grid(row=0, column=2, pady=10)
        # 生成label
        Label(self, text="用户名").grid(row=3, column=1, pady=10)
        Label(self, text="密码").grid(row=4, column=1)
        # 生成用户名和密码输入框
        self.name_input = Entry(self)
        self.name_input.grid(row=3, column=2)
        self.password = Entry(self)
        self.password['show'] = '*'
        self.password.grid(row=4, column=2)

        self.radio = Radiobutton(self, text="rsa", variable=self.radio_value, padx=20, value=1)
        self.radio.grid(row=5, column=1)

        self.radio1 = Radiobutton(self, text="des", variable=self.radio_value, padx=20, value=2)
        self.radio1.grid(row=6, column=1)

        self.alert_button = Button(self, text='提交', command=self.submit)
        self.alert_button.grid(row=7, column=1)