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


Python Radiobutton.grid方法代码示例

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


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

示例1: Interface

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

示例2: addRadioButton

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

示例3: minormax

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
    def minormax(self):
        objheader = headersmall(self.frame, text="Objective:")

        rmim = Radiobutton(self.frame, text="Minimize", variable=self.params["objective"], value="min", bg=Styles.colours["grey"])
        rmax = Radiobutton(self.frame, text="Maximize", variable=self.params["objective"], value="max", bg=Styles.colours["grey"])

        objheader.grid(row=7, column=1, sticky=W, columnspan=2)
        rmim.grid(row=8, column=1, pady=0, sticky=W, padx=10)
        rmax.grid(row=9, column=1, pady=0, sticky=W, padx=10)
开发者ID:jakedm,项目名称:projectb,代码行数:11,代码来源:selection.py

示例4: time

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
	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)
开发者ID:satnet-project,项目名称:propagators,代码行数:12,代码来源:configure_simulations.py

示例5: create_radio_buttons

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
 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:,项目名称:,代码行数:13,代码来源:

示例6: Show

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
    def Show():
        Gui.configuration.ReadConfiguration()

        Gui.top = Tkinter.Tk()
        Gui.top.title("SGS performance test")

        label = Label(Gui.top, text="Select options and execute tasks", height=2)
        label.grid(row=0, sticky=W)

        # ########################################################

        Gui.var = IntVar()
        Gui.var.set(1 if Gui.configuration.IsBuildTypeDebug() else 2)
        R1 = Radiobutton(Gui.top, text="Debug Build", variable=Gui.var, value=1, height=2,command=Gui.BuildType)
        R1.grid(row=1, sticky=W)
        R2 = Radiobutton(Gui.top, text="Release Build", variable=Gui.var, value=2, height=2, command=Gui.BuildType)
        R2.grid(row=2, sticky=W)

        # ########################################################

        Gui.dirLabel = Label(Gui.top, text='Dir: ', bd=4)
        Gui.dirLabel.grid(row=3, sticky=W)
        Gui.UpdateDirLabel()

        dirButton = Tkinter.Button(Gui.top, text='Select dir containing cpp/external', bd=4, command=Gui.AskDirectory)
        dirButton.grid(row=4, sticky=W)

        # ########################################################

        def SetupCallBack():
           print "Setup"
        setup = Tkinter.Button(Gui.top, text ="Setup", bd=4, command = Gui.SetupCallBack)
        setup.grid(row=5, sticky=W)

        def ExecuteCallBack():
           print "Execute"
        execute = Tkinter.Button(Gui.top, text ="Execute", bd=4, command = Gui.ExecuteCallBack)
        execute.grid(row=6, sticky=W)

        # new line
        print ''
        Gui.top.mainloop()
开发者ID:robertjacobs,项目名称:mahusandbox,代码行数:44,代码来源:setupGUI.py

示例7: add_screen

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
    def add_screen(self, fr, title):

        b = Radiobutton(self.rb_fr, bd=1, text=title, indicatoron=0, \
                        variable=self.choice, value=self.count, \
                        command=lambda: self.display(fr))
        
        b.grid(column=self.count, row=0, sticky=N + E + W)
        self.rb_fr.columnconfigure(self.count, weight=1)

        fr.grid(sticky=N + W + E)
        self.screen_fr.columnconfigure(0, weight=1)
        fr.grid_remove()

        # ensures the first frame will be
        # the first selected/enabled
        if not self.active_fr:
            fr.grid()
            self.active_fr = fr

        self.count += 1

        # returns a reference to the newly created
        # radiobutton (allowing its configuration/destruction)
        return b
开发者ID:arnew,项目名称:dxf2gcode,代码行数:26,代码来源:widgets.py

示例8: solver

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
    def solver(self):
        solverheader = headersmall(self.frame, text="Solvers:")
        direct = Radiobutton(self.frame, text="Direct", variable=self.params["solver"], value="direct",
                             bg=Styles.colours["grey"])
        lbfgs = Radiobutton(self.frame, text="LBFGS", variable=self.params["solver"], value="lbfgs",
                            bg=Styles.colours["grey"])
        message = Message(self.frame, text="Enable normalization if you use lbfgs", width=200)
        try:
            import nlopt
        except:
            self.params["solver"].set("lbfgs")
            self.params["normalize"].set(1)
            direct.config(state=DISABLED)
            message.config(text="You do not have nlopt library installed to use the Direct Solver",
                           bg=Styles.colours["lightRed"])

        normalize = Checkbutton(self.frame, text="Normalize Input", variable=self.params["normalize"],
                                bg=Styles.colours["grey"])

        solverheader.grid(row=1, column=0, sticky=W, columnspan=2)
        direct.grid(row=2, column=0, pady=0, sticky=W, padx=10)
        lbfgs.grid(row=3, column=0, pady=0, sticky=W, padx=10)
        message.grid(row=2, column=1, rowspan=1)
        normalize.grid(row=3, column=1)
开发者ID:jakedm,项目名称:projectb,代码行数:26,代码来源:selection.py

示例9: initial

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

示例10: rec

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

示例11: getDist

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
class getDist():
    def __init__(self, master):
        self.master=master
        self.startwindow()
        #self.b=0    # no need for this, directly store in the global variable

    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)
    def ButtonClick(self):
        global dist
        dist = self.var1.get()
        self.master.quit()

    def cb1select(self):
        return self.var1.get()
开发者ID:debboutr,项目名称:instripTrick,代码行数:40,代码来源:instagramPhotoQuery_RD.py

示例12: PaymentWindow

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
class PaymentWindow(Frame):

	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)
	

#		Style().configure('green/black.TButton', foreground='black', background='black')
#		
#		self.L1 = Entry(self,state = DISABLED, disabledforeground = parent.cget('bg'))
#		self.L1.pack()#

#		self.B1 = Button(self, text = "Are You Alive???", command = self.hello)
#		self.B1.pack()#

#		self.B2 = Button(self, text = "DISSAPEAR???", command = self.goodbye)
#		self.B2.pack()
	
	def cancel(self):
		self.graphics.liftLayer("transaction")

	def submit(self):
		self.creditCardNumber.config(text="f")
		self.name.config(text="f")
		if self.selected == "credit":
			number = self.creditCardNumber.get()
			name = self.name.get()
			payment = Payment(self.selected,number)
		else:
			payment = Payment(self.selected)

		self.graphics.POS.getCurrentTransaction().setPayment(payment)
		self.complete()


	def credit(self):
		print "credit"
		self.selected = "credit"
		self.creditCardNumberLabel.config(state="active", bg=self.graphics.mainColor)
		self.creditCardNumber.config(state="active")
		self.nameLabel.config(state="active", bg=self.graphics.mainColor)
		self.name.config(state="active")

	def cash(self):
		print "cash"
		self.selected = "cash"
		self.creditCardNumberLabel.config(state="disabled", bg=self.graphics.mainColor)
		self.creditCardNumber.config(state="disabled")
		self.nameLabel.config(state="disabled", bg=self.graphics.mainColor)
		self.name.config(state="disabled")	

	def complete(self):
		self.creditCardNumber.config(text="")
		self.name.config(text="")
		self.outputLabel.config(text=" ")
		
		print "completing transaction"

		#color = "#D1D1D1"
		color = "#e8e8e8"
		width=35

#.........这里部分代码省略.........
开发者ID:aknuck,项目名称:nextGenPOS,代码行数:103,代码来源:PaymentWindow.py

示例13: Label

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
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)
fQ_entry = Entry(root, textvariable=fQ_value)
niter_label = Label(root, text=names[9])
开发者ID:lponnala,项目名称:glee-py-gui,代码行数:33,代码来源:glee.py

示例14: Label

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

root.grid()
开发者ID:lponnala,项目名称:glee-py-gui,代码行数:33,代码来源:trial.py

示例15: __draw_current_choice

# 需要导入模块: from Tkinter import Radiobutton [as 别名]
# 或者: from Tkinter.Radiobutton import grid [as 别名]
    def __draw_current_choice(self, parent):
        
        choice = IntVar()
        other_player = StringVar()
        recommended = self.game.most_recommended_player_remaining()
        valuable = self.game.get_best_player_remaining()
        
        recommended_button = Radiobutton(parent, text=recommended, variable=choice, value=1)
        valuable_button = Radiobutton(parent, text=valuable, variable=choice, value=2)
        other_button = Radiobutton(parent, text="", variable=choice, takefocus=0, value=3)
        other_text = Entry(parent, textvariable=other_player)
        
        def text_focus(event):
            other_button.select()
        
        other_text.bind("<Button-1>", text_focus)

        def pick_player():

            decision = choice.get()

            if decision == 1:

                player = self.game.most_recommended_player_remaining()
                self.game.add_player_to_team(player)
                utils.remove_player_from_possible_players(
                    player,
                    self.game.connection,
                    self.game.cursor)
                self.user_pick_made.set(True)

            elif decision == 2:

                player = self.game.get_best_player_remaining()
                self.game.add_player_to_team(player)
                utils.remove_player_from_possible_players(
                    player,
                    self.game.connection,
                    self.game.cursor)
                self.user_pick_made.set(True)

            elif decision == 3:
                player = other_player.get()
                try:
                    self.game.add_player_to_team(player)
                    utils.remove_player_from_possible_players(
                        player,
                        self.game.connection,
                        self.game.cursor)
                    self.user_pick_made.set(True)
                except:
                    tkMessageBox.showinfo("Error", "Can't add that player to team, try again.")
                    self.user_pick_logic()

            else:
                tkMessageBox.showinfo("No Selection", "Please make a selection")
                self.user_pick_logic()

        def pick_player_button(event):
            pick_player()

        Label(parent, text="Recommended Player").grid(sticky="w", row=1)
        recommended_button.grid(sticky="w", row=1, column=1, columnspan=2)
        
        Label(parent, text="Most Valuable Player").grid(sticky="w", row=2)
        valuable_button.grid(sticky="w", row=2, column=1, columnspan=2)
        
        Label(parent, text="Choose other Player").grid(sticky="w", row=3)
        other_button.grid(sticky="w", row=3, column=1)
        other_text.grid(row=3, column=2, sticky="w", padx=5)
        
        pick_button = Button(parent, text="Pick", command=pick_player).grid(
            row=4, columnspan=3, sticky="ne", padx=5)
        self.parent.bind("<Return>", pick_player_button)
开发者ID:BarnettMichael,项目名称:FantasyFootballHelper,代码行数:76,代码来源:FFHGui.py


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