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


Python Tkinter.Radiobutton类代码示例

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


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

示例1: create_other_buttons

    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
开发者ID:AtomicConductor,项目名称:conductor_client,代码行数:16,代码来源:SearchDialogBase.py

示例2: Interface

class Interface(Frame):
    """界面操作"""

    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.create_widgets()

    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)

    def submit(self):
        """提交处理"""
        name = self.name_input.get() or 'username'
        password = self.password.get() or "password"
        cryption = self.radio_value.get() or "1"
        # 构造传输的数据
        data = name + ',' + password

        cryption = Crypt()
        my_socket = Mysocket()
        # 判断使用des还是rsa
        if cryption == 2:
            data = "des" + data
            need = 8 - (len(data) % 8)
            while need > 0:
                data += " "
                need -= 1
            result = cryption.des_encrypt(data)
            result = "des" + result
        else:
            result = cryption.rsa_encrypt(data)
            result = "rsa" + result
        result = my_socket.make_connect(result)

        if result >= 0:
            tkMessageBox.showinfo('Message', '%s' % '合法用户')
        else:
            tkMessageBox.showinfo('Message', '%s' % '非法用户')
开发者ID:brittyu,项目名称:Homework,代码行数:60,代码来源:interface.py

示例3: startwindow

    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)
开发者ID:debboutr,项目名称:instripTrick,代码行数:25,代码来源:instagramPhotoQuery_RD.py

示例4: __init__

 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()
开发者ID:fmihaich,项目名称:annic,代码行数:25,代码来源:samples_collection.py

示例5: addRadioButton

def addRadioButton(frame, label, value, variable, position, bindEvent=1):
    button = Radiobutton(frame, text=label, variable=variable, value=value)
    button.grid(row=0, column=position)
    
    if bindEvent:
        variable.trace("w", calculate)
        
    return button
开发者ID:slepeweb,项目名称:java-sandbox,代码行数:8,代码来源:mypass.py

示例6: build_devices_arch

    def build_devices_arch(self):

        #8bits
        name_checked = self.main.configIDE.config("Board", "board_8", "Pinguino 2550")
        arch_8 = filter(lambda board:board.arch==8, self.main.pinguinoAPI._boards_)
        arch_8.sort()

        frame_left = Frame(self.frame_8b)
        frame_left.pack(expand=True, fill=BOTH, side=LEFT)

        frame_right = Frame(self.frame_8b)
        frame_right.pack(expand=True, fill=BOTH, side=RIGHT)

        parent = frame_left  #left
        for board in arch_8:
            if arch_8.index(board) == (len(arch_8) / 2) + 1:
                parent = frame_right  #rigth

            radio = Radiobutton(parent, text=board.name, anchor="w", width=10, value=board.name, variable=self.dev8_var, command=lambda :self.set_board_name(board.name, "8"))
            radio.pack(expand=True, fill=X, side=TOP)

            #radio = QtGui.QRadioButton(self.board_config.groupBox_devices_8)
            #self.board_config.gridLayout_device_8.addWidget(radio, count, side, 1, 1)
            #radio.setText(board.name)
            #radio.setToolTip(board.proc)

            if name_checked == board.name: radio.select()
            #self.connect(radio, QtCore.SIGNAL("clicked()"), self.set_board_name(board.name, "8"))


        #32bits
        name_checked = self.main.configIDE.config("Board", "board_32", "PIC32 Pinguino OTG")
        arch_32 = filter(lambda board:board.arch==32, self.main.pinguinoAPI._boards_)
        arch_32.sort()

        frame_left0 = Frame(self.frame_32b)
        frame_left0.pack(expand=True, fill=BOTH, side=LEFT)

        frame_right0 = Frame(self.frame_32b)
        frame_right0.pack(expand=True, fill=BOTH, side=RIGHT)

        parent = frame_left0  #left
        for board in arch_32:
            if arch_32.index(board) == (len(arch_32) / 2) + 1:
                parent = frame_right0  #rigth

            radio = Radiobutton(parent, text=board.name, anchor="w", width=10, value=board.name, variable=self.dev32_var, command=lambda :self.set_board_name(board.name, "32"))
            radio.pack(expand=True, fill=X, side=TOP)

            #radio = QtGui.QRadioButton(self.board_config.groupBox_devices_32)
            #self.board_config.gridLayout_device_32.addWidget(radio, count, side, 1, 1)
            #radio.setText(board.name)
            #radio.setToolTip(board.proc)

            if name_checked == board.name: radio.select()
开发者ID:PinguinoIDE,项目名称:pinguino-ide-tk,代码行数:55,代码来源:board_config.py

示例7: create_radio_buttons

 def create_radio_buttons(self):
     # Scale related
     entries = ['DIATONIC', 'HARMONIC', 'MELODIC', 'PENTATONIC', 'PENTA_MINOR']
     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)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例8: create_other_buttons

    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()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:12,代码来源:SearchDialogBase.py

示例9: __init__

    def __init__(self, master, size=22, **kw):
        image = Metro_Radiobutton.image[size]
        
        if isinstance(image, basestring):
            Metro_Radiobutton.image[size] = image = BitmapImage(data=base64.b64decode(image))

        selectimage = Metro_Radiobutton.selectimage[size]
        
        if isinstance(selectimage, basestring):
            Metro_Radiobutton.selectimage[size] = selectimage = BitmapImage(data=base64.b64decode(selectimage))

        Radiobutton.__init__(self, master, indicatoron=0, selectimage=selectimage, image=image, highlightthickness=0, borderwidth=0, **kw)
开发者ID:jacob-carrier,项目名称:code,代码行数:12,代码来源:recipe-580783.py

示例10: __init__

    def __init__(self,parent,view,lissajou,subjectSig,subjects):

        self.cursorFrame = Frame(parent)
        self.selectionFrame = Frame(self.cursorFrame)
        self.view = view
        self.lissajou = lissajou
        self.subjects = subjects
        self.subjectSig=subjectSig
        self.amp=IntVar()
        self.scale_amp=Scale(self.cursorFrame,variable=self.amp,
                          label="Amplitude",
                          orient="horizontal",length=250,from_=0,to=10,
                          sliderlength=50,tickinterval=1,showvalue=0,
                          command=self.update)
        self.freq=IntVar()
        self.scale_freq=Scale(self.cursorFrame,variable=self.freq,
                          label="Frequence",
                          orient="horizontal",length=250,from_=0,to=10,
                          sliderlength=50,tickinterval=0,showvalue=0,
                          command=self.update)
        self.offset=DoubleVar()
        self.scale_offset=Scale(self.cursorFrame,variable=self.offset,
                          label="Offset",
                          orient="horizontal",length=250,from_=-10.0,to=10.0,
                          sliderlength=50,tickinterval=5,showvalue=0,
                          command=self.update)

        self.phase=IntVar()
        self.scale_phase=Scale(self.cursorFrame,variable=self.phase,
                          label="Phase",
                          orient="horizontal",length=250,from_=-90,to=90,
                          sliderlength=10,tickinterval=45,showvalue=0,
                          command=self.update)


        self.voltVar = DoubleVar()
        self.voltVar.set(1)
        self.button1 = Radiobutton(self.selectionFrame, text="1V", variable=self.voltVar,
                                    value=1.0*5.0,command =lambda:self.update(None))
        self.button1.select()

        self.button2 = Radiobutton(self.selectionFrame, text="2V", variable=self.voltVar,
                                    value=2.0*5.0, command =lambda:self.update(None))

        self.button5 = Radiobutton(self.selectionFrame, text="5V", variable=self.voltVar,
                                    value=5.0*5.0, command =lambda:self.update(None))

        self.isOffsetVar= IntVar()
        self.isOffset = Checkbutton(self.selectionFrame,text = "Offset",variable = self.isOffsetVar,
                                    command =lambda:self.update(None))
开发者ID:theMonarK,项目名称:Oscilloscope_Simulator,代码行数:50,代码来源:controls.py

示例11: create_other_buttons

    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()
开发者ID:0xcc,项目名称:python-read,代码行数:17,代码来源:SearchDialogBase.py

示例12: initial

    def initial(self):
        iniheader = headersmall(self.frame, text="Initial points sampler:")

        latin = Radiobutton(self.frame, text="Latin", variable=self.params["initializer"], value="latin",
                            bg=Styles.colours["grey"])
        sobol = Radiobutton(self.frame, text="Sobol", variable=self.params["initializer"], value="sobol",
                            bg=Styles.colours["grey"])
        uniform = Radiobutton(self.frame, text="Uniform", variable=self.params["initializer"], value="uniform",
                              bg=Styles.colours["grey"])

        iniheader.grid(row=4, column=1, sticky=W, columnspan=1)
        latin.grid(row=5, column=1, pady=0, sticky=W, padx=10)
        sobol.grid(row=6, column=1, pady=0, sticky=W, padx=10)
        uniform.grid(row=7, column=1, pady=0, sticky=W, padx=10)
开发者ID:jakedm,项目名称:projectb,代码行数:14,代码来源:selection.py

示例13: rec

    def rec(self):
        recheader = headersmall(self.frame, text="Recommender:")

        incumbent = Radiobutton(self.frame, text="Incumbent", variable=self.params["recommender"], value="incumbent",
                                bg=Styles.colours["grey"])
        latent = Radiobutton(self.frame, text="Latent", variable=self.params["recommender"], value="latent",
                             bg=Styles.colours["grey"])
        observed = Radiobutton(self.frame, text="Observed", variable=self.params["recommender"], value="observed",
                               bg=Styles.colours["grey"])

        recheader.grid(row=4, column=0, sticky=W, columnspan=1)
        incumbent.grid(row=5, column=0, pady=0, sticky=W, padx=10)
        latent.grid(row=6, column=0, pady=0, sticky=W, padx=10)
        observed.grid(row=7, column=0, pady=0, sticky=W, padx=10)
开发者ID:jakedm,项目名称:projectb,代码行数:14,代码来源:selection.py

示例14: add_screen

    def add_screen( self, fr, title ):

        b = Radiobutton( self.rb_fr, text=title, indicatoron=0, \
            variable=self.choice, value=self.count, \
            command=lambda: self.display( fr ), padx=10, pady=5 )
        b.pack( fill=BOTH, side=self.side )

        # ensures the first frame will be
        # the first selected/enabled
        if not self.active_fr:
            fr.pack( fill=BOTH, expand=1 )
            self.active_fr = fr

        self.count += 1

        # returns a reference to the newly created
        # radiobutton (allowing its configuration/destruction)         
        return b
开发者ID:hardbyte,项目名称:scipy-sim,代码行数:18,代码来源:tabs.py

示例15: __init__

    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)
开发者ID:tekrei,项目名称:PythonExamples,代码行数:18,代码来源:pyXOXPlayer.py


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