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


Python Radiobutton.select方法代码示例

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


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

示例1: create_other_buttons

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
    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,代码行数:18,代码来源:SearchDialogBase.py

示例2: select_start_options

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
  def select_start_options(self):
    '''
    popup box to select side and difficulty levels
    '''
    print 'select game start options'

    popup = Toplevel(self.gui, width=300, height=110)
    popup.title('Choose Game Side and Level')

    # stays on top of the game canvass
    popup.transient(self.gui)
    popup.grab_set()

    # bind window close events
    popup.bind('<Escape>', lambda e: self.not_selected_start_options(popup))
    popup.protocol("WM_DELETE_WINDOW", lambda : self.not_selected_start_options(popup))

    # choose side
    label1 = Label(popup, text="Side", height=30, width=50)
    label1.place(x=10, y=5, height=30, width=50)

    val1 = IntVar()

    bt_north = Radiobutton(popup, text="White", variable=val1, value=1)
    bt_north.place(x=60, y=10)
    bt_south = Radiobutton(popup, text="Black", variable=val1, value=2)
    bt_south.place(x=120, y=10)

    # by default, human plays first, meaning play the north side
    if self.choose_side == 'north':
      bt_north.select()
    else:
      bt_south.select()

    # choose difficulty level
    label2 = Label(popup, text="Level", height=30, width=50)
    label2.place(x=10, y=35, height=30, width=50)

    val2 = IntVar()

    bt_level1 = Radiobutton(popup, text="Dumb", variable=val2, value=1)
    bt_level1.place(x=60, y=40)
    bt_level2 = Radiobutton(popup, text="Smart", variable=val2, value=2)
    bt_level2.place(x=120, y=40)
    bt_level3 = Radiobutton(popup, text="Genius", variable=val2, value=3)
    bt_level3.place(x=180, y=40)

    # by default, the game is medium level
    if self.choose_level == 1:
      bt_level1.select()
    elif self.choose_level == 2:
      bt_level2.select()
    elif self.choose_level == 3:
      bt_level3.select()

    button = Button(popup, text='SET', \
              command=lambda: self.selected_start_options(popup, val1, val2))

    button.place(x=70, y=70)
开发者ID:Caicai1124,项目名称:Artificial-Intelligence,代码行数:61,代码来源:tkui.py

示例3: build_devices_arch

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
    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,代码行数:57,代码来源:board_config.py

示例4: create_other_buttons

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
    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,代码行数:19,代码来源:SearchDialogBase.py

示例5: __init__

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
    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,代码行数:20,代码来源:pyXOXPlayer.py

示例6: init_gui

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
    def init_gui(self):
        """init helper"""
        #setting up frames
        top_frame = Frame(self.root)
        mid_frame = Frame(self.root)
        radio_frame = Frame(self.root)
        res_frame = Frame(self.root)
        msg_frame = Frame(self.root)
        check_frame = Frame(self.root)
        history_frame = Frame(self.root)
        btn_frame = Frame(self.root)
        rating_frame = Frame(self.root)
        top_frame.pack(side=TOP, fill=X)
        mid_frame.pack(side=TOP, fill=X)
        history_frame.pack(side=TOP, fill=BOTH, expand=True)
        radio_frame.pack(side=TOP, fill=BOTH, expand=True)
        rating_frame.pack(side=TOP, fill=BOTH, expand=True)
        res_frame.pack(side=TOP, fill=BOTH, expand=True)
        check_frame.pack(side=TOP, fill=BOTH, expand=True)
        msg_frame.pack(side=TOP, fill=BOTH, expand=True)
        btn_frame.pack(side=TOP, fill=X)

        #Message ListBox
        rightscrollbar = Scrollbar(msg_frame)
        rightscrollbar.pack(side=RIGHT, fill=Y)
        bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL)
        bottomscrollbar.pack(side=BOTTOM, fill=X)
        self.lbMessages = Listbox(msg_frame,
                  yscrollcommand=rightscrollbar.set,
                  xscrollcommand=bottomscrollbar.set,
                  bg="white")
        self.lbMessages.pack(expand=True, fill=BOTH)
        rightscrollbar.config(command=self.lbMessages.yview)
        bottomscrollbar.config(command=self.lbMessages.xview)

        #History ListBoxes
        rightscrollbar2 = Scrollbar(history_frame)
        rightscrollbar2.pack(side=RIGHT, fill=Y)
        bottomscrollbar2 = Scrollbar(history_frame, orient=HORIZONTAL)
        bottomscrollbar2.pack(side=BOTTOM, fill=X)
        self.showhistory = Listbox(history_frame,
                    yscrollcommand=rightscrollbar2.set,
                    xscrollcommand=bottomscrollbar2.set,
                    bg="white")
        self.showhistory.pack(expand=True, fill=BOTH)
        rightscrollbar2.config(command=self.showhistory.yview)
        bottomscrollbar2.config(command=self.showhistory.xview)
        self.showhistory.bind('<Double-Button-1>', self.select_recent_file)
        self.set_history_window()

        #status bar
        self.status = Label(self.root, text="", bd=1, relief=SUNKEN, anchor=W)
        self.status.pack(side=BOTTOM, fill=X)

        #labels
        self.lblRatingLabel = Label(rating_frame, text='Rating:')
        self.lblRatingLabel.pack(side=LEFT)
        self.lblRating = Label(rating_frame, textvariable=self.rating)
        self.lblRating.pack(side=LEFT)
        Label(mid_frame, text='Recently Used:').pack(side=LEFT)
        Label(top_frame, text='Module or package').pack(side=LEFT)

        #file textbox
        self.txtModule = Entry(top_frame, background='white')
        self.txtModule.bind('<Return>', self.run_lint)
        self.txtModule.pack(side=LEFT, expand=True, fill=X)

        #results box
        rightscrollbar = Scrollbar(res_frame)
        rightscrollbar.pack(side=RIGHT, fill=Y)
        bottomscrollbar = Scrollbar(res_frame, orient=HORIZONTAL)
        bottomscrollbar.pack(side=BOTTOM, fill=X)
        self.results = Listbox(res_frame,
                  yscrollcommand=rightscrollbar.set,
                  xscrollcommand=bottomscrollbar.set,
                  bg="white", font="Courier")
        self.results.pack(expand=True, fill=BOTH, side=BOTTOM)
        rightscrollbar.config(command=self.results.yview)
        bottomscrollbar.config(command=self.results.xview)

        #buttons
        Button(top_frame, text='Open', command=self.file_open).pack(side=LEFT)
        Button(top_frame, text='Open Package', command=(lambda : self.file_open(package=True))).pack(side=LEFT)

        self.btnRun = Button(top_frame, text='Run', command=self.run_lint)
        self.btnRun.pack(side=LEFT)
        Button(btn_frame, text='Quit', command=self.quit).pack(side=BOTTOM)

        #radio buttons
        self.information_box = IntVar()
        self.convention_box = IntVar()
        self.refactor_box = IntVar()
        self.warning_box = IntVar()
        self.error_box = IntVar()
        self.fatal_box = IntVar()
        i = Checkbutton(check_frame, text="Information", fg=COLORS['(I)'], variable=self.information_box, command=self.refresh_msg_window)
        c = Checkbutton(check_frame, text="Convention", fg=COLORS['(C)'], variable=self.convention_box, command=self.refresh_msg_window)
        r = Checkbutton(check_frame, text="Refactor", fg=COLORS['(R)'], variable=self.refactor_box, command=self.refresh_msg_window)
        w = Checkbutton(check_frame, text="Warning", fg=COLORS['(W)'], variable=self.warning_box, command=self.refresh_msg_window)
        e = Checkbutton(check_frame, text="Error", fg=COLORS['(E)'], variable=self.error_box, command=self.refresh_msg_window)
#.........这里部分代码省略.........
开发者ID:imcj,项目名称:pybbs,代码行数:103,代码来源:gui.py

示例7: IntVar

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
nobinning_value = IntVar(); nobinning_value.set(1)
nobinning_check = Checkbutton(root, variable=nobinning_value, onvalue=1, offvalue=0, command=check_binning)
p_label = Label(root, text=names[3])
p_value = IntVar(); p_value.set(p_default)
p_entry = Entry(root, textvariable=p_value)
fbL_label = Label(root, text=names[4])
fbL_value = DoubleVar(); fbL_value.set(fbL_default)
fbL_entry = Entry(root, textvariable=fbL_value)
fbH_label = Label(root, text=names[5])
fbH_value = DoubleVar(); fbH_value.set(fbH_default)
fbH_entry = Entry(root, textvariable=fbH_value)
binchoice_label = Label(root, text=names[6])
binchoice_frame = Frame(root)
binchoice_value = StringVar()
equal = Radiobutton(binchoice_frame,text='equal',variable=binchoice_value,value='equal',command=check_binchoice)
equal.select()
adaptive = Radiobutton(binchoice_frame,text='adaptive',variable=binchoice_value,value='adaptive',command=check_binchoice)
equal.grid(row=0,column=0)
adaptive.grid(row=0,column=1)
binchoice_frame.grid()
fitType_label = Label(root, text=names[7])
fitType_frame = Frame(root)
fitType_value = StringVar()
linear = Radiobutton(fitType_frame,text='linear',variable=fitType_value,value='linear')
cubic = Radiobutton(fitType_frame,text='cubic',variable=fitType_value,value='cubic')
cubic.select()
linear.grid(row=0,column=0)
cubic.grid(row=0,column=1)
fitType_frame.grid()
fQ_label = Label(root, text=names[8])
fQ_value = DoubleVar(); fQ_value.set(fQ_default)
开发者ID:lponnala,项目名称:glee-py-gui,代码行数:33,代码来源:glee.py

示例8: Label

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
	if binchoice_value.get().strip()=='adaptive':
		print 'adaptive'
	else:
		print 'equal'

nobinning_label = Label(root, text='No binning')
nobinning_value = IntVar(); nobinning_value.set(1)
nobinning_check = Checkbutton(root, variable=nobinning_value, onvalue=1, offvalue=0, command=check_binning)
p_label = Label(root, text='num_bins')
p_value = IntVar(); p_value.set(20)
p_entry = Entry(root, textvariable=p_value)
binchoice_label = Label(root, text='binchoice')
binchoice_frame = Frame(root)
binchoice_value = StringVar()
equal = Radiobutton(binchoice_frame,text='equal',variable=binchoice_value,value='equal')
equal.select()
adaptive = Radiobutton(binchoice_frame,text='adaptive',variable=binchoice_value,value='adaptive',command=check_binchoice)
equal.grid(row=0,column=0)
adaptive.grid(row=0,column=1)
binchoice_frame.grid()
check_binning()
check_binchoice()
submit_button = Button(root, text='RUN', command=run_glee)

nobinning_label.grid(row=0,column=0)
nobinning_check.grid(row=0,column=1)
p_label.grid(row=1,column=0, padx=5,pady=5)
p_entry.grid(row=1,column=1, padx=5,pady=5)
binchoice_label.grid(row=2,column=0, padx=5,pady=5)
binchoice_frame.grid(row=2,column=1, padx=5,pady=5)
submit_button.grid(row=3,column=0, padx=5,pady=5, columnspan=2, sticky='nsew')
开发者ID:lponnala,项目名称:glee-py-gui,代码行数:33,代码来源:trial.py

示例9: Controller

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
class Controller(Observer):
    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))

    def update(self,event):
        self.update_amplitude(event)
        self.update_offset(event)
        self.update_frequency(event)
        self.update_phase(event)
        self.view.update()
        if self.lissajou!=None:
            self.lissajou.update()


    def update_amplitude(self,event):
        print("update_amplitude(self,event)",self.amp.get())
        self.subjectSig.set_magnitude(self.amp.get()/self.voltVar.get())
        self.subjects.generate_XYCurve()
    def update_frequency(self,event):
        print("update_frequency(self,event)",self.freq.get())
        self.subjectSig.set_frequency(self.freq.get())
        self.subjects.generate_XYCurve()
    def update_phase(self,event):
        print("update_phase(self,event)",self.phase.get())
        self.subjectSig.set_phase(self.phase.get())
        self.subjects.generate_XYCurve()
    def update_offset(self,event):
        if self.isOffsetVar.get():
            print("update_offset(self,event)",self.isOffsetVar.get())
            self.subjectSig.set_offset(self.offset.get()/self.voltVar.get())
            self.subjects.generate_XYCurve()
        else:
            self.subjectSig.set_offset(0.0)
            self.subjects.generate_XYCurve()

    def setLissajou(self,lissajou):
        self.lissajou = lissajou


    def packing(self) :
        self.selectionFrame.pack(side='top')
        self.button1.pack(side='left')
        self.button2.pack(side='left')
        self.button5.pack(side='left')
        self.isOffset.pack(side='left')
        self.cursorFrame.pack(side='left',expand=1, fill='both')
        self.scale_amp.pack()
        self.scale_freq.pack()
        self.scale_offset.pack()
        self.scale_phase.pack()
开发者ID:theMonarK,项目名称:Oscilloscope_Simulator,代码行数:100,代码来源:controls.py

示例10: _create_setup_tab

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import select [as 别名]
 def _create_setup_tab(self, nb):
     
     frame = Frame(nb, name='setup')
     
     self.e1 = Entry(frame, width=7)
     self.e1.bind()
     self.e1.grid(row=0, column=1)
     self.e1.delete(0, END)
     self.e1.insert(0, '21')
     
     self.label1 = Label(frame, text='Number of points:')
     self.label1.grid(row=0, column=0, sticky=W)
     
     self.e2 = Entry(frame, width=7)
     self.e2.bind()
     self.e2.grid(row=1, column=1)
     self.e2.delete(0, END)
     self.e2.insert(0, '0.05')
     
     self.label2 = Label(frame, text='Max. Lagrangian strain:')
     self.label2.grid(row=1, column=0, sticky=W)
     
     #Choose inputfile (Button)
     b2 = Button(frame, text="Inputfile", width=15, command=self.select_file)
     b2.grid(row=3, column=0, columnspan=2)
     
     b = Button(frame, text="set values", width=15, command=self.read_val)
     b.grid(row=4, column=0, columnspan=2)
     
     #Read structure (Button)
     b1 = Button(frame, text="Read structure", width=15, command=self.read_POS)
     b1.grid(row=5, column=0, columnspan=2)
     
     #Write structures (Button)
     b3 = Button(frame, text="Setup calculation", width=15, command=self.setup_calc)
     b3.grid(row=6, column=0, columnspan=2)
     
     #Strart calculations
     b4 = Button(frame, text="Calculation status", width=15, command=self.check_calc)
     b4.grid(row=7, column=0, columnspan=2)
     
     
     v = IntVar()
     r11 = Radiobutton(frame, text="Energy", variable=v, value=1)
     r12 = Radiobutton(frame, text="Strain", variable=v, value=2, state=DISABLED)
     r11.select()
     r11.grid(row=8, column=0, sticky=W)
     r12.grid(row=9, column=0, sticky=W)
     
     
     w = IntVar()
     r21 = Radiobutton(frame, text="2nd", variable=w, value=1)
     r22 = Radiobutton(frame, text="3rd", variable=w, value=2)
     r21.select()
     r21.grid(row=10, column=0, sticky=W)
     r22.grid(row=11, column=0, sticky=W)
     
     
     nb.add(frame, text='Setup', underline=0, padding=2)
     
     return
开发者ID:tdengg,项目名称:pylastic,代码行数:63,代码来源:main.py


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