Exemplo n.º 1
0
class StartPage(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

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

        self.rb1 = Radiobutton(self, text="X", variable=self.rb, value=0)
        self.rb2 = Radiobutton(self, text="Y", variable=self.rb, value=1)

        self.rb1.pack()
        self.rb2.pack()

        self.page_one_button = Button(self,
                                      text="Next Page",
                                      command=self.operation)
        self.page_one_button.pack()

    def operation(self):
        if self.rb.get() == 0:
            print("You chose X")
            new_window(self)
            app.withdraw()
        elif self.rb.get() == 1:
            print("You chose Y")
            app.show_frame(PageOne)
        else:
            print("Error")
Exemplo n.º 2
0
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        #窗口大小位置
        self.master.geometry("600x400+100+400")  #长x宽+x+y
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        self.helloLabel = Label(self, text='Hello, world!\n')
        self.helloLabel.pack()

        self.c1 = Radiobutton(
            self,
            text="1",
            command=lambda: self.helloLabel.config(text="1被选中了奇数次\n"))
        self.c1.pack()
        self.c2 = Radiobutton(
            self,
            text="2",
            command=lambda: self.helloLabel.config(text="2被选中了奇数次\n"))
        self.c2.pack()
        self.quitButton = Button(self,
                                 text='Quit',
                                 fg="red",
                                 command=self.quit)
        self.quitButton.pack()
Exemplo n.º 3
0
 def __open_mark(self):
     '''Open files by mark: Major dialogue for mark choices and logic'''
     ### despite using select, invoke, focus_set, event_generate,
     ### tk wouldn't set the OR radiobutton as default.
     ### So the following sub-function is a workaround to force the issue.
     def default_selection(var):
         var.set("or")
     def lookup(toc,gl,word):
         l = len(word)
         for i, item in enumerate(toc):
             if item.find(word,0,l) > -1:
                 gl.see(i)
                 break
     dprint(3, "\nTkMemobook::open_mark:: ")
     toc = [ item for item in self.data.toc() ]
     toc.sort(key=lambda x: x.lower())
     getter = Toplevel(self.root)
     getter_list = ListboxHV(getter, selectmode="multiple")
     for item in toc:
         getter_list.insert(END, item)
     getter_list.pack(fill="both", expand="true")
     quick_var = StringVar()
     quick_var.trace_add("write",
                         lambda i,j,k: lookup(toc,getter_list,quick_var.get()))
     quick_frame = Frame(getter)
     quick_label = Label(quick_frame,
                         text="Quick lookup:")
     quick_enter = Entry(quick_frame,
                         textvariable=quick_var,
                         width=24)
     quick_label.pack(side="left")
     quick_enter.pack(side="left")
     button_frame = Frame(getter)
     
     logic_variable = StringVar(None, "or")
     radiobutt_OR = Radiobutton(button_frame,
                                text="OR",
                                variable=logic_variable,
                                command=lambda: default_selection(logic_variable),  # get tk to give default selection
                                value="or")
     radiobutt_AND = Radiobutton(button_frame,
                                 text="AND",
                                 variable=logic_variable,
                                 value="and")
     retbutt = Button(button_frame,
                      text="Apply",
                      command=lambda: self.__open_mark_confirm(getter,
                                                               [ toc[int(j)] for j in getter_list.curselection() ],
                                                               logic_variable.get()))
     cancbutt = Button(button_frame,
                       text="Cancel",
                       command=lambda: getter.destroy())
     radiobutt_OR.pack(side="left")
     radiobutt_AND.pack(side="left")
     cancbutt.pack(side="left")
     retbutt.pack(side="left")
     button_frame.pack(side="bottom")
     quick_frame.pack(side="bottom")
     radiobutt_OR.invoke()
Exemplo n.º 4
0
def radio1():  # local vars are temporary
    '''
    Example of variables issues
    '''
    # global tmp                 # making it global fixes the problem
    tmp = IntVar()
    for i in range(10):
        rad = Radiobutton(root, text=str(i), value=i, variable=tmp)
        rad.pack(side=LEFT)
    tmp.set(5)  # select 6th button
Exemplo n.º 5
0
 def show(self):
     frame = Frame(Interface.functional_area)
     frame.pack(fill=X)
     label = Label(frame, text=self._button_text)
     label.pack(side=LEFT)
     for text, value in self._options:
         radio_button = Radiobutton(frame,
                                    variable=self._value,
                                    text=text,
                                    value=value)
         radio_button.pack(side=LEFT)
Exemplo n.º 6
0
    def _options_for_radio_btn(self):
        MODES = [
            ("Treinamento", "1"),
            ("Classificação", "2")
        ]
        v = tk.StringVar()
        v.set("1")  # initialize

        for text, mode in MODES:
            b = Radiobutton(root, text=text, variable=v, value=mode)
            b.pack(anchor=W, padx=(0, 10))
Exemplo n.º 7
0
	def __init__(self, label_text, selection_list, command, *args, **kwargs):
		ttk.LabelFrame.__init__(self, *args, **kwargs)
		self.inner_frame = Frame(self)
		self.inner_frame.pack(fill = "both", expand = True, side = "left")
		self.configure(text = label_text)
		self.var = IntVar()
		for text, value in selection_list:
			b = Radiobutton(self.inner_frame, text = text, variable = self.var, value = value, command = command)
			b.pack(anchor = "w", fill = "y", expand = False)
		#select first button
		for s in selection_list: self.var.set(s[1]); break
Exemplo n.º 8
0
def radio2(root):
    '''
    Builds the scond frame
    :param root: the parent
    '''
    global var  # a reference that goes away later
    var = IntVar()
    for i in range(10):
        rad = Radiobutton(root, text=str(i), value=i, variable=var)
        rad.pack(side=LEFT)
    var.set(2)
Exemplo n.º 9
0
def Radio(root, lists = [], **options):

  props = {
    
  }

  for idx, val in enumerate(lists):
    R = Radiobutton(root, value=idx, text=val)

    R.config(**options)
    R.pack()
Exemplo n.º 10
0
def radio1(root):  # local vars are temporary
    '''
    Buils the first frame
    :param root: the parent
    '''
    # global tmp                 # making it global fixes the problem
    tmp = IntVar()
    for i in range(10):
        rad = Radiobutton(root, text=str(i), value=i, variable=tmp)
        rad.pack(side=LEFT)
    tmp.set(5)
Exemplo n.º 11
0
    def add_radio_button_group(self, buttons, command, selected=1):
        variable = IntVar()
        variable.set(selected)

        for value, text in buttons.items():
            radio_button = Radiobutton(self,
                                       text=text,
                                       value=value,
                                       variable=variable,
                                       command=lambda: command(variable.get()),
                                       indicatoron=False)
            radio_button.pack(side=LEFT, fill=X)
Exemplo n.º 12
0
 def init_reformat_display(self):
     orientation_var = IntVar(0)
     orientation_var.trace_add('write', self.__reformat_callback)
     count = 0
     for text, value in self._ORIENTATIONS:
         b = Radiobutton(self,
                         text=text,
                         variable=orientation_var,
                         value=count)
         b.pack(side=tk.TOP, anchor='w')
         count += 1
     self._orientation = orientation_var
Exemplo n.º 13
0
    def __init__(self, x, y, board):
        self.boardA = board
        self.boardB = copy(board)
        self.root = Toplevel()
        self.root.title("Piece Placement Editing Window")

        f1 = Frame(self.root)  #frame containing the save and cancel buttons
        f1.pack(side=TOP)

        f2 = Frame(self.root)  #frame containing piece selection
        f2.pack(side=LEFT)

        b1 = Button(f1, text="SAVE", command=self.save)
        b2 = Button(f1, text="CANCEL", command=self.root.destroy)
        b1.pack(side=LEFT)
        b2.pack(side=RIGHT)

        l1 = Label(f2, text="Type")
        l2 = Label(f2, text="Colour")

        self.c1 = ttk.Combobox(
            f2, values=__piece_types__)  #menu for piece type selection
        self.c1.current(0)

        l1.pack()
        self.c1.pack()
        l2.pack()

        self.v1 = StringVar()  #radiobuttons for piece colour selection
        self.v1.set("red")
        for c in __player_colours__:
            b = Radiobutton(f2, text=c, variable=self.v1, value=c)
            b.pack()

        self.v2 = BooleanVar()
        c = Checkbutton(f2,
                        text="Centrally Symmetrical Opponent",
                        variable=self.v2)
        self.v2.set(False)
        c.pack()

        self.canvas = Canvas(self.root, width=320, height=320)
        self.boardB.canvas = self.canvas
        self.canvas.bind("<Button-1>", self.callback1)
        self.canvas.bind("<Button-3>", self.callback2)
        self.canvas.pack(side=BOTTOM)

        self.redraw(0)

        self.align(x, y)

        self.root.mainloop()
Exemplo n.º 14
0
 def create_other_buttons(self):
     "Fill frame with buttons tied to other options."
     frame = self.make_frame("Direction")[0]
     var = self.engine.backvar
     others = [(1, 'Up'), (0, 'Down')]
     for val, label in others:
         btn = Radiobutton(frame, anchor="w",
                           variable=var, value=val, text=label)
         btn.pack(side="left", fill="both")
         #print(var.get(), val, label)
         if var.get() == val:
             btn.select()
     return frame, others  # for test
Exemplo n.º 15
0
 def _layout_primerDesign_line2(self):
     check_species = Frame(self.options)
     check_species.pack(fill = X, pady = 5)
     
     sp = Label(check_species, text = 'Species:', 
                font = ("Arial", 10), width = 6)
     sp.pack(side = LEFT)
     
     self.species_var = StringVar()
     self.species_var.set(1)
     Issp = Radiobutton(check_species, text = "S. pombe", 
                        variable = self.species_var, value = "P")
     Issp.bind("<Button-1>", self._getfocusback)
     Issp.pack(side = LEFT)
     Issj = Radiobutton(check_species, text = "S. japonicus", 
                        variable=self.species_var, value = "J")
     Issj.bind("<Button-1>", self._getfocusback)
     Issj.pack(side = LEFT)
     Issc = Radiobutton(check_species, text = "S. cryophilus", 
                        variable = self.species_var, value = "C")
     Issc.bind("<Button-1>", self._getfocusback)
     Issc.pack(side = LEFT)
     Isso = Radiobutton(check_species, text = "S. octosporus", 
                        variable = self.species_var, value = "O")
     Isso.bind("<Button-1>", self._getfocusback)
     Isso.pack(side = LEFT)
Exemplo n.º 16
0
 def _layout_primerDesign_line4_2(self):
     self.check_Ntag = Frame(self.options)
     self.check_Ntag.pack(after = self.check_mode, pady = 5)
     self.check_Ntag.forget()
     
     nt = Label(self.check_Ntag, text = 'N-terminal Tag:', 
                font = ("Arial", 10), width = 10)
     nt.pack(side = LEFT)
     
     self.Ntag_var = StringVar()
     self.Ntag_var.set(' ')
     Isnone = Radiobutton(self.check_Ntag, text = "None", 
                        variable = self.Ntag_var, value = ' ')
     Isnone.bind("<Button-1>", self._getfocusback)
     Isnone.pack(side=LEFT)
     Is3HA = Radiobutton(self.check_Ntag, text = "3HA", 
                       variable = self.Ntag_var, value = '3HA')
     Is3HA.bind("<Button-1>", self._getfocusback)
     Is3HA.pack(side = LEFT)
     IsGST = Radiobutton(self.check_Ntag, text = "GST", 
                       variable = self.Ntag_var, value = 'GST')
     IsGST.bind("<Button-1>", self._getfocusback)
     IsGST.pack(side = LEFT)
     IsGFP = Radiobutton(self.check_Ntag, text = "GFP", 
                         variable = self.Ntag_var, value = 'GFP')
     IsGFP.bind("<Button-1>", self._getfocusback)
     IsGFP.pack(side = LEFT)
Exemplo n.º 17
0
class Select_Py_Version(_Dialog):
    """
    Select_Py_Version is a tkinter pop-up dialog used to select a python
    interpreter for use with Tk_Nosy.
    """

    def body(self, master):
        dialogframe = Frame(master, width=300, height=300)
        dialogframe.pack()


        self.Label_1 = Label(dialogframe, text="Select Python Version")
        self.Label_1.pack()

        if self.dialogOptions:
            rbL = self.dialogOptions.get('rbL', ['No Options','No Options'])
        else:
            rbL = ['No Options', 'No Options']

        self.RadioGroup1_StringVar = StringVar()
        self.RadioGroup1_StringVar.set(rbL[0])
        self.RadioGroup1_StringVar_traceName = \
            self.RadioGroup1_StringVar.trace_variable("w", self.RadioGroup1_StringVar_Callback)

        for rb in rbL:
            self.Radiobutton_1 = Radiobutton(dialogframe, text=rb, value=rb)
            self.Radiobutton_1.pack(anchor=W)
            self.Radiobutton_1.configure( variable=self.RadioGroup1_StringVar )
        self.resizable(0, 0) # Linux may not respect this


    def RadioGroup1_StringVar_Callback(self, varName, index, mode):
        """When radio group selection changes, print message to CLI."""
        print( "RadioGroup1_StringVar_Callback varName, index, mode",
                varName, index, mode )
        print( "    new StringVar value =", self.RadioGroup1_StringVar.get() )


    def validate(self):
        """Validates and packages dialog selections prior to return to calling
           routine.
           set values in "self.result" dictionary for return
        """
        self.result = {} # return a dictionary of results

        self.result["selection"] = self.RadioGroup1_StringVar.get()
        return 1

    def apply(self):
        print( 'apply called')
Exemplo n.º 18
0
    def create_other_buttons(self):
        """Return (frame, others) for testing.

        Others is a list of value, label pairs.
        A gridded frame from make_frame is filled with radio buttons.
        """
        frame = self.make_frame("Direction")[0]
        var = self.engine.backvar
        others = [(1, "Up"), (0, "Down")]
        for val, label in others:
            btn = Radiobutton(frame, anchor="w", variable=var, value=val, text=label)
            btn.pack(side="left", fill="both")
            if var.get() == val:
                btn.select()
        return frame, others
Exemplo n.º 19
0
    def mainFrame(self, master):

        # Main frame
        frame = Frame(master)
        frame.pack()

        # CRC logo
        sys.path.append('../../../../images/CRC_Logo.png')
        img = ImageTk.PhotoImage(Image.open("../../../../images/CRC_Logo.png"))
        # TODO: Fix icon
        # master.iconbitmap("../../../../images/CRC_Logo.ico")
        img_panel = Label(master, image=img)
        img_panel.image = img
        img_panel.pack()

        banner = Label(master,
                       text='Welcome to the Ratings Trader',
                       font=('Helvetica', 24))
        banner.pack(side="bottom", fill="both", expand="yes")

        choose_brokerage_label = Label(master, text='Choose your brokerage:')
        choose_brokerage_label.pack()

        # Engineered in such a way that one can add more brokerages (in the form of radio buttons) if
        # further functionality is sought. For now, this is more of a proof of concept than a product,
        # so for those reasons, interfacing with other brokerage APIs is not a priority.

        # Tkinter variable to determine callback values
        self.selection = IntVar()

        no_selection = Radiobutton(master,
                                   text='[None]',
                                   variable=self.selection,
                                   value=0,
                                   command=self.selection_callback)
        no_selection.pack()
        IB_selection = Radiobutton(master,
                                   text='Interactive Brokers',
                                   variable=self.selection,
                                   value=1,
                                   command=self.selection_callback)
        IB_selection.pack()

        more = Label(master, text='More brokerages to come...')
        more.pack()

        next = Button(master, text='Next')
        next.pack()
Exemplo n.º 20
0
class Circulation_Channel(Frame):
    def __init__(self, parent, system, channel_number, background_color=None):

        font1 = font.Font(family='Calibri', size=12, weight='bold')
        font2 = font.Font(family='Verdana', size=8)
        font3 = font.Font(family='Verdana', size=10, weight='bold')

        Frame.__init__(self, parent)

        self.config(height=8, width=5)
        self.configure(bg=background_color)

        self.button_width = 10

        self.ch_title = "Switch %s " % str(channel_number)
        self.ch_label = Label(self,
                              text=self.ch_title,
                              font=font1,
                              bg=background_color)

        self.circulation_mode = StringVar()
        self.circulation_mode.set('collect')
        self.recirculate = Radiobutton(self,
                                       text='Recirculate',
                                       variable=self.circulation_mode,
                                       value='recirculate',
                                       bg=background_color,
                                       indicatoron=0,
                                       width=self.button_width)
        self.collect = Radiobutton(self,
                                   text='Collect',
                                   variable=self.circulation_mode,
                                   value='collect',
                                   bg=background_color,
                                   indicatoron=0,
                                   width=self.button_width)
        #add validation for entry using vcmd

        self.recirculate['command'] = lambda: system.setRecirculate(
            channel_number)
        self.collect['command'] = lambda: system.setCollect(channel_number)

        self.recirculate.pack(side="right", padx=5)
        self.collect.pack(side="right", padx=5)
        self.ch_label.pack(side="left", padx=5)

    def getCirculationMode(self):
        return self.circulation_mode.get()
Exemplo n.º 21
0
 def __init__(self, parent=None, picks=None, side=LEFT, anchor=W):
     '''
     Constructor
     :param parent: the parent
     :param picks:
     :param side: the side to pack to
     :param anchor: the location
     '''
     if not picks:
         picks = []
     Frame.__init__(self, parent)
     self.var = StringVar()
     self.var.set(picks[0])
     for pick in picks:
         rad = Radiobutton(self, text=pick, value=pick, variable=self.var)
         rad.pack(side=side, anchor=anchor, expand=YES)
Exemplo n.º 22
0
class Select_Py_Version(_Dialog):
    """
    Select_Py_Version is a tkinter pop-up dialog used to select a python
    interpreter for use with Tk_Nosy.
    """
    def body(self, master):
        dialogframe = Frame(master, width=300, height=300)
        dialogframe.pack()

        self.Label_1 = Label(dialogframe, text="Select Python Version")
        self.Label_1.pack()

        if self.dialogOptions:
            rbL = self.dialogOptions.get('rbL', ['No Options', 'No Options'])
        else:
            rbL = ['No Options', 'No Options']

        self.RadioGroup1_StringVar = StringVar()
        self.RadioGroup1_StringVar.set(rbL[0])
        self.RadioGroup1_StringVar_traceName = \
            self.RadioGroup1_StringVar.trace_variable("w", self.RadioGroup1_StringVar_Callback)

        for rb in rbL:
            self.Radiobutton_1 = Radiobutton(dialogframe, text=rb, value=rb)
            self.Radiobutton_1.pack(anchor=W)
            self.Radiobutton_1.configure(variable=self.RadioGroup1_StringVar)
        self.resizable(0, 0)  # Linux may not respect this

    def RadioGroup1_StringVar_Callback(self, varName, index, mode):
        """When radio group selection changes, print message to CLI."""
        print("RadioGroup1_StringVar_Callback varName, index, mode", varName,
              index, mode)
        print("    new StringVar value =", self.RadioGroup1_StringVar.get())

    def validate(self):
        """Validates and packages dialog selections prior to return to calling
           routine.
           set values in "self.result" dictionary for return
        """
        self.result = {}  # return a dictionary of results

        self.result["selection"] = self.RadioGroup1_StringVar.get()
        return 1

    def apply(self):
        print('apply called')
Exemplo n.º 23
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()
Exemplo n.º 24
0
    def RadioButton(self, text: str, anchor: str = "w") -> bool:
        """
            create radio button
            keyword arguments:
            text -- the text of the button
            anchor -- the anchor of the button (default "w")
        """

        b1 = Radiobutton(self.ChoiseFrame,
                         text=text,
                         variable=self.choix,
                         value=text,
                         font=("Courrier", 9),
                         bg=self.back,
                         fg=self.TextColor,
                         anchor=anchor)
        b1.pack(anchor=anchor)
        return 0
Exemplo n.º 25
0
 def MakeRadioList(parent, data):
     # create a frame to hold the radio buttons
     lable_frame = LabelFrame(parent, text=data["name"], labelanchor=NW)
     # create a variable to hold the result of the user's decision
     radio_var = StringVar(value=data["default"]);
     # setup orientation
     side = TOP
     anchor = W
     if "horizontal" in data and data["horizontal"]:
         side = LEFT
         anchor = N
     # add the radio buttons
     for option in data["options"]:
         radio_button = Radiobutton(lable_frame, text=option["description"], value=option["value"], variable=radio_var,
                                    justify=LEFT, wraplength=data["wraplength"])
         radio_button.pack(expand=True, side=side, anchor=anchor)
     # return the frame so it can be packed, and the var so it can be used
     return (lable_frame, radio_var)
Exemplo n.º 26
0
    def __init__(self, master, blockchain=None, client=None):
        Frame.__init__(self, master)
        self.master = master
        self.blockchain = blockchain
        self.client = client
        self.user = None
        print('public key :' + str(self.client.public_key))
        # user id
        id_frame = Frame(self)
        id_frame.pack()
        id_label = Label(id_frame, text ='User ID')
        id_label.pack(side = LEFT)
        self.id_entry = Entry(id_frame, bd=5)
        self.id_entry.pack(side = LEFT)
        
        # year
        year_frame = Frame(self)
        year_frame.pack()
        self.year_var = IntVar()

        years = [('2007',2007),('2008',2008),('2009',2009),('2010',2010),('2011',2011)]
        for text, value in years:
            rb = Radiobutton(year_frame, text=text, variable=self.year_var, value=value, command = self.sel)
            rb.pack(anchor=W)

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

        # password
        password_frame = Frame(self)
        password_frame.pack()
        password_label = Label(password_frame, text ='Password')
        password_label.pack(side = LEFT)
        self.password_entry = Entry(password_frame, bd=5)
        self.password_entry.pack(side = LEFT)
        
        # login button
        w = tkinter.Button(self, bg='Green', text='Login',command = self.login)
        w.pack() 

        # back to register button
        r = tkinter.Button(self, bg='blue', text='Register',
                        command = lambda: master.switch_frame(RegisterPage, self.blockchain, self.client))
        r.pack(side = LEFT) 
Exemplo n.º 27
0
    def bit_pos_radiobutton(self, master):
        '''
        Another gui setup helper function.
        '''

        label_frame = LabelFrame(master, text="Bit Postion Selection")
        label_frame.grid(row=0, column=1)

        self.bit_pos = IntVar()

        for pos in range(0, 8):
            name = "bit " + str(pos)
            rb = Radiobutton(label_frame,
                             text=name,
                             variable=self.bit_pos,
                             value=pos)
            rb.pack(side='left')

        self.bit_pos.set(0)
Exemplo n.º 28
0
    def create_other_buttons(self):
        '''Return (frame, others) for testing.

        Others is a list of value, label pairs.
        A gridded frame from make_frame is filled with radio buttons.
        '''
        frame = self.make_frame("Direction")[0]
        var = self.engine.backvar
        others = [(1, 'Up'), (0, 'Down')]
        for val, label in others:
            btn = Radiobutton(frame,
                              anchor="w",
                              variable=var,
                              value=val,
                              text=label)
            btn.pack(side="left", fill="both")
            if var.get() == val:
                btn.select()
        return frame, others
Exemplo n.º 29
0
 def _layout_primerDesign_line4_1(self):
     self.blankframe = Frame(self.options)
     self.blankframe.pack(after = self.check_mode, pady = 18)
     
     self.check_plsmd = Frame(self.options)
     self.check_plsmd.pack(after = self.check_mode, pady = 5)
     self.check_plsmd.forget()
     
     pl = Label(self.check_plsmd, text = 'Plasmid:', 
                font = ("Arial", 10), width = 10)
     pl.pack(side = LEFT)
     self.plasmid_var = StringVar()
     self.plasmid_var.set(3)
     IspFA6a = Radiobutton(self.check_plsmd, text = "pFA6a", 
                           variable = self.plasmid_var, value = 'pFA6a')
     IspFA6a.bind("<Button-1>", self._getfocusback)
     IspFA6a.pack(side = LEFT)
     IsKS = Radiobutton(self.check_plsmd, text = "KS-ura4", 
                        variable = self.plasmid_var, value = 'KS-ura4')
     IsKS.bind("<Button-1>", self._getfocusback)
     IsKS.pack(side = LEFT)
Exemplo n.º 30
0
    def variable_quantity_subframe(self, master):
        '''
        Another gui setup helper function.
        '''

        label_frame = LabelFrame(master, text="Variable Quantity Selection")
        #label_frame.pack()
        label_frame.grid(row=2, column=1)

        self.var_val_sel = IntVar()
        rb_addr = Radiobutton(label_frame,
                              text="Address",
                              variable=self.var_val_sel,
                              value=self.VarSel.addr.value)
        rb_addr.pack(anchor='w')

        rb_inj_time = Radiobutton(label_frame,
                                  text="Injection Time",
                                  variable=self.var_val_sel,
                                  value=self.VarSel.inj_time.value)
        rb_inj_time.pack(anchor='w')

        rb_pos = Radiobutton(label_frame,
                             text="Bit Position",
                             variable=self.var_val_sel,
                             value=self.VarSel.bit_pos.value)
        rb_pos.pack(anchor='w')

        self.var_val_sel.set(self.VarSel.addr.value)
Exemplo n.º 31
0
    def __init__(self, root, func):
        self.choosing_frame = Frame \
            (root, height=60, width=100, bg='lightblue')
        self.var = IntVar()
        rbutton1 = Radiobutton(self.choosing_frame,
                               text='Easy',
                               variable=self.var,
                               value=1,
                               bg='lightblue')
        rbutton2 = Radiobutton(self.choosing_frame,
                               text='Hard',
                               variable=self.var,
                               value=2,
                               bg='lightblue')
        rbutton3 = Radiobutton(self.choosing_frame,
                               text='Random',
                               variable=self.var,
                               value=3,
                               bg='lightblue')
        button1 = Button(self.choosing_frame, text='Ok', bg='lightblue')
        rbutton1.select()
        rbutton1.pack(side='left')
        rbutton2.pack(side='left')
        rbutton3.pack(side='left')
        button1.pack(side='left')

        button1.bind('<1>', lambda e: func())
Exemplo n.º 32
0
 def __init__(self, root, switch_mode):
     self.choosing_frame = Frame \
         (root, height=60, width=100, bg='lightblue')
     self.var = IntVar()
     rbutton1 = Radiobutton(self.choosing_frame,
                            text='PvE',
                            variable=self.var,
                            value=1,
                            bg='lightblue')
     rbutton2 = Radiobutton(self.choosing_frame,
                            text='PvP',
                            variable=self.var,
                            value=2,
                            bg='lightblue')
     rbutton3 = Radiobutton(self.choosing_frame,
                            text='EvE',
                            variable=self.var,
                            value=3,
                            bg='lightblue')
     button = Button(self.choosing_frame, text='Ok', bg='lightblue')
     rbutton1.select()
     rbutton1.pack(side='left')
     rbutton2.pack(side='left')
     rbutton3.pack(side='left')
     button.pack(side='left')
     button.bind('<1>', switch_mode)
Exemplo n.º 33
0
    def __init__(self, root):
        self.root = root
        self.root.title('计算器一代')
        self.center_window(self.root, 300, 240)
        self.root.maxsize(200, 200)
        self.root.minsize(200, 200)

        self.menuBar = Menu(self.root)
        self.root.config(menu=self.menuBar)
        aboutMenu = Menu(self.menuBar, tearoff=0)
        # 创建一个下拉菜单‘功能’,这个菜单是挂在menubar(顶级菜单)上的
        FuncMenu = Menu(self.menuBar, tearoff=0)
        # 用add_cascade()将菜单添加到顶级菜单中,按添加顺序排列
        self.menuBar.add_cascade(label='功能', menu=FuncMenu)
        self.menuBar.add_cascade(label='帮助', menu=aboutMenu)
        # 下拉菜单的具体项目,使用add_command()方法
        aboutMenu.add_command(label='关于..', command=self.About)

        FuncMenu.add_command(label='小键盘计算', command=self.Fun2)
        FuncMenu.add_command(label='表达式计算', command=self.Fun1)

        self.label = Label(self.root, text='欢迎使用!', font=14).pack(side=TOP)
        self.group = LabelFrame(self.root, text='您想进行的操作是:', padx=5, pady=5)
        self.group.pack(padx=10, pady=10)
        self.Key = [('小键盘计算', 1), ('表达式计算', 2)]
        self.v = IntVar()
        self.v.set(1)
        for m, n in self.Key:
            b = Radiobutton(self.group, text=m, variable=self.v, value=n)
            b.pack(anchor=W)

        self.button1 = Button(self.root, text='确定', command=self.show, padx=10)
        self.button2 = Button(self.root,
                              text='退出',
                              command=self.root.quit,
                              padx=10)
        self.button1.pack(side=RIGHT)
        self.button2.pack(side=LEFT)

        self.root.bind('<Return>', self.show)
Exemplo n.º 34
0
 def _layout_blast_line1(self):
     # BLAST species selection
     b_species = Frame(self.blast)
     b_species.pack(pady = 5, fill = X)
     
     bspl = Label(b_species, 
                  text = "Target pecies:", 
                  font = ("Arial", 10), width = 10)
     self.bsp_var = StringVar()
     self.bsp_var.set(5)
     bIssj = Radiobutton(b_species, 
                         text = "S. japonicus", 
                         variable = self.bsp_var, value = "J")
     bIssj.bind("<Button-1>", self._focusB)
     bIssc = Radiobutton(b_species, 
                         text = "S. cryophilus", 
                         variable = self.bsp_var, value = "C")
     bIssc.bind("<Button-1>", self._focusB)
     bIsso = Radiobutton(b_species, 
                         text = "S. octosporus", 
                         variable = self.bsp_var, value = "O")
     bIsso.bind("<Button-1>", self._focusB)
     bIsso.pack(side = RIGHT)
     bIssc.pack(side = RIGHT)
     bIssj.pack(side = RIGHT)
     bspl.pack(side = RIGHT)
Exemplo n.º 35
0
tag_frame = Frame(option_frame, height=50, width=150)
tag_frame.pack(side=TOP)

tag_frame_top = Frame(tag_frame)
tag_frame_top.pack(side=TOP)
corpus_label = Label(tag_frame_top, text='Corpus path:')
corpus_label.pack(side=LEFT)
corpus_file_var = StringVar()
corpus_entry = Entry(tag_frame_top, textvariable=corpus_file_var, bd=5)
corpus_entry.pack(side=LEFT)
tag_frame_bottom = Frame(tag_frame)
tag_frame_bottom.pack(side=TOP)
language_var = StringVar()
english_radio = Radiobutton(
    tag_frame_bottom, text='English', variable=language_var, value='en')
english_radio.pack(side=LEFT)
spanish_radio = Radiobutton(
    tag_frame_bottom, text='Spanish', variable=language_var, value='es')
spanish_radio.pack(side=LEFT)
tag_button = Button(
    tag_frame_bottom, text='OK', command=tag_button_cmd)
tag_button.pack(side=LEFT)


pattern_frame = Frame(option_frame, height=50, width=150)
pattern_frame.pack(side=TOP)
pattern_content = Text(pattern_frame, height=10, width=50)
pattern_content.pack()
pattern_button = Button(pattern_frame, text='OK', command=pattern_button_cmd)
pattern_button.pack()