本文整理汇总了Python中Tkinter.LabelFrame类的典型用法代码示例。如果您正苦于以下问题:Python LabelFrame类的具体用法?Python LabelFrame怎么用?Python LabelFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LabelFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MeasureFrame
class MeasureFrame(LabelFrame):
def __init__(self, master, tracker, text="Measuring", *args, **kwargs):
LabelFrame.__init__(self, master, text=text, *args, **kwargs)
self.tracker = tracker
self.config_frame = NamedEntryFrame(self, (OBS_INTERVAL,
NUM_SAMPLES,
NUM_OBSS),
parsers={OBS_INTERVAL: float,
NUM_SAMPLES: int,
NUM_OBSS: int})
self.config_frame.grid()
self.save_frame = LabelFrame(self, text="Saving")
self.dest_selector = FileSelectionFrame(self.save_frame,
ask_mode="save")
self.dest_selector.grid(row=0, column=0, columnspan=2)
self.save_button = Button(self.save_frame, text="Save",
command=bg_caller(self.save))
self.save_button.grid(row=1, column=0)
self.appending_var = BooleanVar()
self.append_checkbutton = Checkbutton(self.save_frame, text="Append",
variable=self.appending_var)
self.append_checkbutton.grid(row=1, column=1)
self.save_frame.grid()
def measure(self, only_accurate=True):
try:
interval = self.config_frame.get(OBS_INTERVAL)
samples = self.config_frame.get(NUM_SAMPLES)
num_obss = self.config_frame.get(NUM_OBSS)
except ValueError:
logger.error("Could not parse input fields.")
data = self.tracker.measure(observation_interval=interval,
samples_per_observation=samples,
number_of_observations=num_obss)
if only_accurate:
accurate_data = [point for point in data
if point.status == point.DATA_ACCURATE]
num_invalid = len(data) - len(accurate_data)
if num_invalid > 0:
logger.warning("Hiding {} inaccurate data points."
.format(num_invalid))
return accurate_data
else:
return data
def save(self, only_accurate=True):
dest = self.dest_selector.path_var.get()
if not dest:
logger.error("Must select a destination file.")
return
data = self.measure(only_accurate=only_accurate)
w = csv.writer(open(dest, 'a' if self.appending_var.get() else 'w'))
for point in data:
w.writerow((point.time, point.position.r,
point.position.theta, point.position.phi))
logger.info("Saved measurements into {!r}".format(dest))
示例2: initUI
def initUI(self):
"Text to enter the clear text"
self.clearLabelFrame = LabelFrame(self.parent, text = "Search Text")
self.clearLabelFrame.place(x = 65, y = 20)
self.clearText = Text(self.clearLabelFrame, width = 65, height = 5)
self.clearText.pack()
"Button to encode"
self.encodeButton = Button(self.parent, text = "Search", command = self.search)
self.encodeButton.place(x = 460, y = 130)
"Text to display encoded text"
self.encodedLabelFrame = LabelFrame(self.parent, text = "Tweets")
self.encodedLabelFrame.place(x = 65, y = 160)
self.encodedText = Text(self.encodedLabelFrame, width = 65, height = 15)
self.encodedText.pack()
"Send tweet"
self.clearLabelFrame = LabelFrame(self.parent, text = "Tweet")
self.clearLabelFrame.place(x = 65, y = 400)
self.sendTweet = Text(self.clearLabelFrame, width = 65, height = 5)
self.sendTweet.pack()
"Button to encode"
self.encodeButton = Button(self.parent, text = "Send", command = self.send)
self.encodeButton.place(x = 470, y = 500)
示例3: __init__
def __init__(self, x):
LabelFrame.__init__(self, x)
# self.default_font = tkFont.nametofont("TkDefaultFont")
# self.default_font.configure(family="Helvetica",size=10)
self.config(relief=GROOVE)
self.config(borderwidth=2)
self.config(text = "Up Time")
self.config(labelanchor = "n")
self.Hsv = StringVar()
self.Hsv.set("")
self.Hlabel = Label(self, textvariable = self.Hsv)
self.Hlabel.grid(row=0, column=0, sticky="wens")
self.Hlabel.config(font=("Courier", 14))
self.Msv = StringVar()
self.Msv.set("")
self.Mlabel = Label(self, textvariable = self.Msv)
self.Mlabel.grid(row=1, column=0, sticky="wens")
self.Mlabel.config(font=("Courier", 14))
self.Ssv = StringVar()
self.Ssv.set("")
self.Slabel = Label(self, textvariable = self.Ssv)
self.Slabel.grid(row=2, column=0, sticky="wens")
self.Slabel.config(font=("Courier", 14))
self.pack()
示例4: convertChoice
def convertChoice(self):
#Las partes que integran el primer submenu llamado "DE", labelFrame,menu, entrada.
self.labelFrameFrom=LabelFrame(self.master,text="De",background=R.Bgcolor)
self.labelFrameFrom.grid(row=1,column=0,padx=5,pady=3)
self.menuFrom=OptionMenu(self.labelFrameFrom,self.fromLabel,"",)
self.menuFrom.configure(bg=R.White,fg=R.Black,activebackground=R.hoverBtnColor,highlightbackground=R.Bgcolor,
indicatoron=0,image=self.btnFlechaimg, compound='right')
self.menuFrom.grid(row=0,column=0,padx=3,pady=2,sticky=E)
self.entryFrom=Entry(self.labelFrameFrom,justify='center',textvariable=self.fromNumber)
self.entryFrom.grid(row=2,column=0,padx=5,pady=5)
#Las partes que integran el segundo submenu llamado "Hasta", labelFrame, menu, entrada.
self.labelFrameTo=LabelFrame(self.master,text="Hacia",background=R.Bgcolor)
self.labelFrameTo.grid(row=1,column=1,padx=5,pady=3)
self.menuTo=OptionMenu(self.labelFrameTo,self.toLabel,"",)
self.menuTo.configure(bg=R.White,fg=R.Black, activebackground=R.hoverBtnColor,highlightbackground=R.Bgcolor,
indicatoron=0,image=self.btnFlechaimg, compound='right')
self.menuTo.grid(row=0,column=0, padx=3, pady=2, sticky=E)
self.entryTo=Entry(self.labelFrameTo,justify='center',textvariable=self.toNumber,state="readonly")
self.entryTo.configure(bg="red", readonlybackground=R.Bgcolor)
self.entryTo.grid(row=2,column=0,padx=3,pady=5)
示例5: __init__
def __init__(self, root, prtr, settings, log, *arg):
LabelFrame.__init__(self, root, *arg, text="Send gcode")
self.app = root
self.printer = prtr
self.settings = settings
self.log = log
self.entry = Entry(self, width=50)
self.entry.grid(row=1, column=1, columnspan=3, sticky=N+E+W)
self.bSend = Button(self, text="Send", width=4, command=self.doSend, state=DISABLED)
self.bSend.grid(row=1, column=4, padx=2)
self.entry.delete(0, END)
self.entry.bind('<Return>', self.hitEnter)
self.gcv = StringVar(self)
gclist = gcoderef.gcKeys()
self.gcv.set(gclist[0])
l = Label(self, text="G Code Reference:", justify=LEFT)
l.grid(row=2, column=1, columnspan=2, sticky=W)
self.gcm = Combobox(self, textvariable=self.gcv)
self.gcm['values'] = gclist
self.gcm.grid(row=2, column=3, padx=2)
self.gcm.bind('<<ComboboxSelected>>', self.gcodeSel)
示例6: __init__
def __init__(self, master, text="Position", **options):
LabelFrame.__init__(self, master, text=text, **options)
self.tracker = master.tracker
self.listbox = Listbox(self)
self.listbox.widget.configure(selectmode=SINGLE)
self.listbox.grid(row=0, column=0, rowspan=6)
self.name_frame = LabelFrame(self, text="Name")
self.name_field = Entry(self.name_frame)
self.name_field.grid()
self.name_frame.grid(row=0, column=1)
self.save_button = Button(self, text="Save current",
command=bg_caller(self.save_position))
self.save_button.grid(row=1, column=1)
self.go_to_button = Button(self, text="Go to",
command=bg_caller(self.go_to_position))
self.go_to_button.grid(row=2, column=1)
self.delete_button = Button(self, text="Delete",
command=self.delete_position)
self.delete_button.grid(row=3, column=1)
self.write_button = Button(self, text="Write to file",
command=self.write_to_file)
self.write_button.grid(row=4, column=1)
self.load_button = Button(self, text="Load from file",
command=self.load_from_file)
self.load_button.grid(row=5, column=1)
示例7: __init__
def __init__(self, x):
LabelFrame.__init__(self, x)
# self.default_font = tkFont.nametofont("TkDefaultFont")
# self.default_font.configure(family="Helvetica",size=12)
self.config(relief=GROOVE)
self.config(borderwidth=2, padx=5, pady=5)
self.config(text = "Encoder")
self.config(labelanchor = "n")
self.INSTRUCTION = StringVar()
self.INSTRUCTION.set("Instruction")
self.machinecode = StringVar()
self.machinecode.set("")
self.codeEntry = Entry(self, textvariable=self.INSTRUCTION)
#self.codeEntry.configure(font=("Helvetica", 12), width=40)
self.codeEntry.configure(width=40)
self.codeButton = Button(self, text="Compile")
self.VHPL = Label(self, text="VHPL")
self.codeButton.grid(row=0, column=0, rowspan=4, sticky="wens")
self.VHPL.grid(row=0, column=1, sticky="wens")
self.VHPL.config(relief=GROOVE, borderwidth=2)
self.codeEntry.grid(row=1, column=1, sticky="wens")
self.codeEntry.config(fg="green", bg="black")
self.pack()
示例8: __init__
def __init__(self, master, tracker, text="Joystick", **options):
LabelFrame.__init__(self, master, text=text, **options)
self.tracker = tracker
self.width = 400
self.height = 400
self.canvas = Canvas(self, height=self.height, width=self.width)
self.canvas.grid()
self.canvas.create_oval((self.width/2 - 3, self.height/2 - 3,
self.width/2 + 3, self.height/2 + 3))
self.canvas.bind("<Button-1>",
bg_caller(lambda event: self.move_tracker(event)))
self.canvas.bind("<Motion>", self.update_label)
self.motion_label = Label(self, text="",
font=tkFont.Font(family="Courier"))
self.motion_label.grid()
f = LabelFrame(self, text="Sensitivity")
self.sensitivity_scale = Scale(f, from_=0, to=10,
resolution=0.01,
orient=HORIZONTAL,
length=self.width)
self.sensitivity_scale.set(5)
self.sensitivity_scale.grid()
f.grid()
示例9: _init_components
def _init_components(self):
self._panes = PanedWindow(self, orient='horizontal', sashrelief="raised")
self._panes.pack(expand=True, fill='both')
self._left_pane = Frame(self._panes, padx=10, pady=5)
self._right_pane = PanedWindow(self._panes)
self._panes.add(self._left_pane, sticky='n')
self._panes.add(self._right_pane)
self._group_select = GroupSelect(self._left_pane)
self._group_select.pack(expand=True, fill='x')
# spacer
Frame(self._left_pane, height=10).pack()
graph_controls = LabelFrame(self._left_pane, text="Graph options", padx=10, pady=5)
graph_controls.columnconfigure(1, weight=1)
graph_controls.pack(expand=True, fill='x')
self._show_graph_checkbutton = CheckBox(graph_controls, text='Show graph')
self._show_graph_checkbutton.select()
self._show_graph_checkbutton.grid(row=0, columnspan=2, sticky='w')
Label(graph_controls, text='Algorithm').grid(row=1, sticky='w')
self._graph_type = OptionList(graph_controls, values=MainWindow.GRAPH_TYPES.keys())
self._graph_type.config(width=15)
self._graph_type.grid(row=1, column=1, sticky='we')
# spacer
Frame(self._left_pane, height=10).pack()
self._go_button = Button(self._left_pane, text='Go', command=self._go)
self._go_button.pack()
示例10: __init__
def __init__(self, tracker, board, *args, **kwargs):
Frame.__init__(self, *args, **kwargs)
self.tracker = tracker
self.board = board
tracker_subframe = LabelFrame(self, text="Tracker stuff")
self.tracker_button = Button(tracker_subframe, text="Tracker",
command=self.open_tracker_frame)
self.tracker_button.grid()
self.joystick_button = Button(tracker_subframe, text="Joystick",
command=self.open_joystick_frame)
self.joystick_button.grid()
self.reposn_button = Button(tracker_subframe, text="Repositioning",
command=self.open_repositioning_frame)
self.reposn_button.grid()
self.measure_button = Button(tracker_subframe, text="Measure",
command=self.open_measure_frame)
self.measure_button.grid()
self.plotting_button = Button(tracker_subframe, text="Plotting",
command=self.open_plotting_frame)
self.plotting_button.grid()
tracker_subframe.grid()
self.actuator_button = Button(self, text="Actuators",
command=self.open_actuator_frame)
self.actuator_button.grid()
示例11: __init__
def __init__(self, root, prtr, settings, log, *arg):
LabelFrame.__init__(self, root, *arg, text="Extruder")
self.app = root
self.printer = prtr
self.settings = settings
self.log = log
self.bExtrude = Button(self, text="Extrude", width=10, command=self.doExtrude)
self.bExtrude.grid(row=1, column=1, padx=2)
self.spDistance = Spinbox(self, from_=1, to=MAXDIST, width=6, justify=RIGHT)
self.spDistance.grid(row=1, column=2)
self.spDistance.delete(0, END)
self.spDistance.insert(0, STARTDIST)
self.spDistance.bind("<FocusOut>", self.valDistance)
self.spDistance.bind("<Leave>", self.valDistance)
l = Label(self, text="mm", justify=LEFT)
l.grid(row=1, column=3, sticky=W)
self.bReverse = Button(self, text="Reverse", width=10, command=self.doReverse)
self.bReverse.grid(row=2, column=1, padx=2)
self.spSpeed = Spinbox(self, from_=1, to=MAXFEED, width=6, justify=RIGHT)
self.spSpeed.grid(row=2, column=2)
self.spSpeed.delete(0, END)
self.spSpeed.insert(0, self.settings.efeed)
self.spSpeed.bind("<FocusOut>", self.valSpeed)
self.spSpeed.bind("<Leave>", self.valSpeed)
l = Label(self, text="mm/min", justify=LEFT)
l.grid(row=2, column=3, sticky=W)
示例12: __init__
def __init__(self, **kwargs):
master = None if 'master' not in kwargs else kwargs['master']
LabelFrame.__init__(self, master, text='Output Options')
self.config(padx=20, pady=5)
self.cadences = CadenceEntry()
self.cadences.grid(row=0, column=0, sticky=W, in_=self)
self.velocity = VelocitySelect()
self.velocity.grid(row=1, column=0, sticky=W, in_=self)
示例13: __init__
def __init__(self, x):
LabelFrame.__init__(self, x)
# self.default_font = tkFont.nametofont("TkDefaultFont")
# self.default_font.configure(family="Helvetica",size=10)
self.config(relief=GROOVE)
self.config(borderwidth=2)
self.config(text="Decoder")
self.mkButtons()
示例14: __init__
def __init__(self, **kwargs):
master = None if 'master' not in kwargs else kwargs['master']
LabelFrame.__init__(self, master, text='Wheel')
self.unitopts = ['%s (%s)' % (x.name, x.symbol)
for x in WheelEntry.DIA_UNITS]
self.__val = WheelEntry.DIA_UNITS[0]
self.createSpin()
self.create_unit_opts()
示例15: __init__
def __init__(self, root, *arg):
LabelFrame.__init__(self, root, *arg, text="Log")
self.log = Text(self, width=60, height=24, state=DISABLED, wrap=WORD, takefocus="0")
self.log.grid(row=1, column=1, sticky=N+E+W+S)
self.sblog = Scrollbar(self, command=self.log.yview, orient="vertical")
self.sblog.grid(column=2, row=1, sticky=N+S+E)
self.log.config(yscrollcommand=self.sblog.set)