本文整理汇总了Python中Tkinter.RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.RIGHT属性的具体用法?Python Tkinter.RIGHT怎么用?Python Tkinter.RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.RIGHT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def __init__(self, parent, property_dict, *args, **kw):
tk.Frame.__init__(self, parent, *args, **kw)
# create a canvas object and a vertical scrollbar for scrolling it
self.vscrollbar = vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
vscrollbar.pack(fill=tk.Y, side=tk.RIGHT, expand=tk.FALSE)
self.canvas = canvas = tk.Canvas(self, bd=0, highlightthickness=0,
yscrollcommand=vscrollbar.set)
canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.TRUE)
vscrollbar.config(command=canvas.yview)
# reset the view
canvas.xview_moveto(0)
canvas.yview_moveto(0)
# create a frame inside the canvas which will be scrolled with it
self.interior = interior = tk.Frame(canvas)
self.interior_id = canvas.create_window(0, 0, window=interior,
anchor='nw')
self.interior.bind('<Configure>', self._configure_interior)
self.canvas.bind('<Configure>', self._configure_canvas)
self.build(property_dict)
示例2: build
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def build(self, property_dict):
for c in self.interior.winfo_children():
c.destroy()
# Filter property dict
property_dict = {k: v for k, v in property_dict.items()
if self._key_filter_function(k)}
# Prettify key/value pairs for display
property_dict = {self._make_key_pretty(k): self._make_value_pretty(v)
for k, v in property_dict.items()}
# Sort by key and filter
dict_values = sorted(property_dict.items(), key=lambda x: x[0])
for n,(k,v) in enumerate(dict_values):
tk.Label(self.interior, text=k, borderwidth=1, relief=tk.SOLID,
wraplength=75, anchor=tk.E, justify=tk.RIGHT).grid(
row=n, column=0, sticky='nesw', padx=1, pady=1, ipadx=1)
tk.Label(self.interior, text=v, borderwidth=1,
wraplength=125, anchor=tk.W, justify=tk.LEFT).grid(
row=n, column=1, sticky='nesw', padx=1, pady=1, ipadx=1)
示例3: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def __init__(self, master, textvariable=None, *args, **kwargs):
tk.Frame.__init__(self, master)
# Init GUI
self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs)
self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self._y_scrollbar.config(command=self._text_widget.yview)
self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
if textvariable is not None:
if not isinstance(textvariable, tk.Variable):
raise TypeError("tkinter.Variable type expected, {} given.".format(
type(textvariable)))
self._text_variable = textvariable
self.var_modified()
self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified)
self._var_trace = textvariable.trace("w", self.var_modified)
示例4: _init_toolbar
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def _init_toolbar(self):
xmin, xmax = self.canvas.figure.bbox.intervalx
height, width = 50, xmax-xmin
Tk.Frame.__init__(self, master=self.window,
width=int(width), height=int(height),
borderwidth=2)
self.update() # Make axes menu
for text, tooltip_text, image_file, callback in self.toolitems:
if text is None:
# spacer, unhandled in Tk
pass
else:
button = self._Button(text=text, file=image_file,
command=getattr(self, callback))
if tooltip_text is not None:
ToolTip.createToolTip(button, tooltip_text)
self.message = Tk.StringVar(master=self)
self._message_label = Tk.Label(master=self, textvariable=self.message)
self._message_label.pack(side=Tk.RIGHT)
self.pack(side=Tk.BOTTOM, fill=Tk.X)
示例5: addMessageFrame
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def addMessageFrame(self):
frame=Frame(self)
frame.pack(fill=tk.BOTH,side=tk.TOP,\
expand=1,padx=8,pady=5)
self.messagelabel=tk.Label(frame,text='Message',bg='#bbb')
self.messagelabel.pack(side=tk.TOP,fill=tk.X)
self.text=tk.Text(frame)
self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1)
self.text.height=10
scrollbar=tk.Scrollbar(self.text)
scrollbar.pack(side=tk.RIGHT,fill=tk.Y)
self.text.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=self.text.yview)
示例6: pack
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def pack(self):
self.file_selector_button.pack(**self.button_opt)
self.label.pack()
self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
self.selected_files.pack(fill=tkinter.BOTH, expand=True)
示例7: grid
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def grid(self, row=0, column=0):
"""
TODO: to be tested
"""
x = row
y = column
self.file_selector_button.grid(row=x, column=y, **self.button_opt)
x += 1
self.label.grid(row=x, column=y)
x += 1
self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
self.selected_files.grid(row=x, column=y, fill=tkinter.BOTH, expand=True)
x += 1
return (x,y)
示例8: strap_design_frame_builder
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def strap_design_frame_builder(self):
self.strap_inputs_frame = tk.Frame(self.strap_design_frame)
self.strap_inputs_frame.pack(side=tk.LEFT, anchor='nw')
self.strap_calc_frame = tk.Frame(self.strap_design_frame)
self.strap_calc_frame.pack(side=tk.RIGHT ,anchor='ne', fill=tk.BOTH, expand=1)
tk.Label(self.strap_inputs_frame, text="B = ", font=self.helv).grid(row=0, column=0, sticky = tk.E)
tk.Entry(self.strap_inputs_frame, textvariable=self.bs, width=10, validate="key", validatecommand=self.reset_status).grid(row=0, column=1)
tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=0, column=2)
tk.Label(self.strap_inputs_frame, text="H = ", font=self.helv).grid(row=1, column=0, sticky = tk.E)
tk.Entry(self.strap_inputs_frame, textvariable=self.hs, width=10, validate="key", validatecommand=self.reset_status).grid(row=1, column=1)
tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=1, column=2)
self.strap_vbar_size = tk.StringVar()
self.inputs.append(self.strap_vbar_size)
self.strap_vbar_size.set('3')
self.strap_vbar_size_label = tk.Label(self.strap_inputs_frame, text="Shear\nBar Size (#) : ", font=self.helv)
self.strap_vbar_size_label.grid(row=2,column=0, pady=2)
self.strap_vbar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_vbar_size, '3', '4', '5', command=self.reset_status)
self.strap_vbar_size_menu.config(font=self.helv)
self.strap_vbar_size_menu.grid(row=2, column=1, padx= 2, sticky=tk.W)
self.strap_bar_size = tk.StringVar()
self.inputs.append(self.strap_bar_size)
self.strap_bar_size.set('3')
self.strap_bar_size_label = tk.Label(self.strap_inputs_frame, text="Flexure\nBar Size (#) : ", font=self.helv)
self.strap_bar_size_label.grid(row=4,column=0, pady=2)
self.strap_bar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_bar_size, '3', '4', '5','6','7','8','9','10','11','14','18', command=self.reset_status)
self.strap_bar_size_menu.config(font=self.helv)
self.strap_bar_size_menu.grid(row=4, column=1, padx= 2, sticky=tk.W)
self.strap_calc_txtbox = tk.Text(self.strap_calc_frame, height = 25, width = 70, bg= "grey90", font= self.helv_norm, wrap=tk.WORD)
self.strap_calc_txtbox.grid(row=0, column=0, sticky='nsew')
self.strap_scroll = tk.Scrollbar(self.strap_calc_frame, command=self.strap_calc_txtbox.yview)
self.strap_scroll.grid(row=0, column=1, sticky='nsew')
self.strap_calc_txtbox['yscrollcommand'] = self.strap_scroll.set
示例9: create_main_panel
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def create_main_panel(self):
# Panels
top_half = tk.Frame(self.root)
top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5)
message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)")
message.pack(side=tk.TOP, padx=5)
bottom_half = tk.Frame(self.root)
bottom_half.pack(side=tk.LEFT, padx=5, pady=10)
# Images
self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder
self.img_panel.pack(side = tk.LEFT, expand=False, padx=5)
# Joystick
self.init_plot()
self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half)
self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5)
# Recording
textframe = tk.Frame(bottom_half, width=332, height=15, padx=5)
textframe.pack(side=tk.LEFT)
textframe.pack_propagate(0)
self.outputDirStrVar = tk.StringVar()
self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100)
self.txt_outputDir.pack(side=tk.LEFT)
self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S'))
self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record)
self.record_button.pack(side = tk.LEFT, padx=5)
示例10: validate
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def validate(self, valid):
if not valid:
self.notebook.tab(self.tab_id, image = self.img_invalid, compound=tk.RIGHT)
else:
self.notebook.tab(self.tab_id, image = None)
示例11: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def __init__(self, parent):
scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL)
self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED)
scrollbar.configure(command=self.listbox.yview)
self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
示例12: loads_base_material_input_gui
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def loads_base_material_input_gui(self):
tk.Label(self.tab_loads, text="** All Loads Assumed to Act at the Weld Group Centroid**", font=self.f_type_b_big).grid(row=0,column=0,columnspan=6, sticky = tk.W)
tk.Label(self.tab_loads, text="Loading:", font=self.f_type_b).grid(row=1,column=0, sticky = tk.W)
tk.Label(self.tab_loads, text="Materials:", font=self.f_type_b).grid(row=1,column=3, sticky = tk.W)
load_labels = ['Fz (lbs)= \nAxial', 'Fx (lbs)= \nShear X', 'Fy (lbs)= \nShear Y', 'Mx (in-lbs)= \nMoment About X', 'My (in-lbs)= \nMoment About Y', 'Mz = (in-lbs)\nMoment About Z']
self.loads_in = [tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar()]
for load in self.loads_in:
load.set('0.00')
i=0
for label, load in zip(load_labels, self.loads_in):
current_load_row_count = 2+i
tk.Label(self.tab_loads, text=label, font=self.f_type, justify=tk.RIGHT).grid(row=current_load_row_count,column=0, sticky = tk.E)
tk.Entry(self.tab_loads, textvariable=load, width=20).grid(row=current_load_row_count,column=1, sticky = tk.W)
i+=1
material_labels = ['Fexx,weld (ksi)= ','Fy,base 1 (ksi) = ','Fu,base 1 (ksi)= ','t,base 1 (in) = ','Fy,base 2 (ksi) = ','Fu,base 2 (ksi)= ','t,base 2 (in) = ']
self.material_in = [tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar()]
default_material = ['70.00','36.00','58.00','0.375','36.00','58.00','0.375']
for material, default in zip(self.material_in, default_material):
material.set(default)
y=0
for material_label, material in zip(material_labels,self.material_in):
current_material_row_count = 2+y
tk.Label(self.tab_loads, text=material_label, font=self.f_type, justify=tk.RIGHT).grid(row=current_material_row_count,column=3, sticky = tk.E)
tk.Entry(self.tab_loads, textvariable=material, width=15).grid(row=current_material_row_count,column=4, sticky = tk.W)
y+=1
self.run_analysis_button = tk.Button(self.tab_loads,text = "Run Analysis (Quadrant)", command = self.force_analysis, font=self.f_type_b)
self.run_analysis_button.grid(row=current_load_row_count+1, column=0, columnspan=2, pady=10)
self.run_analysis_segment_button = tk.Button(self.tab_loads,text = "Run Analysis (Segment)", command = self.force_analysis_segment, font=self.f_type_b)
self.run_analysis_segment_button.grid(row=current_load_row_count+2, column=0, columnspan=2, pady=10)
self.run_analysis_conservative_button = tk.Button(self.tab_loads,text = "Run Analysis (Conservative)", command = self.force_analysis_conservative, font=self.f_type_b)
self.run_analysis_conservative_button.grid(row=current_load_row_count+3, column=0, columnspan=2, pady=10)
self.design_asd = tk.IntVar()
tk.Checkbutton(self.tab_loads , text=' : Loads are Nominal (ASD)', variable=self.design_asd, font=self.f_type_b).grid(row=current_material_row_count+1, column=4, sticky = tk.W)
self.run_design_button = tk.Button(self.tab_loads,text = "Run AISC Design", command = self.aisc_design, font=self.f_type_b)
self.run_design_button.grid(row=current_material_row_count+2, column=3, columnspan=2, pady=10)
示例13: createWidgets
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def createWidgets(self):
# Show a title
self.title = tk.Label(self,
text = 'Interactive DEMUD',
font = ('Helvetica', 24),
bg = '#ccf')
self.title.grid(ipadx = 100)
# Show selection information
self.selection = tk.Label(self,
textvariable = self.sel_var)
self.selection.grid()
# Show an image
self.image = Image.open('/Users/wkiri/Research/IMBUE/data/mastcam/multispectral_drcl/mastcam-034.jpg')
self.photo = ImageTk.PhotoImage(self.image)
self.imglbl = tk.Label(self, image = self.photo)
self.imglbl.grid()
# Show the user feedback options:
# 1. Interesting
# 2. Maybe
# 3. Uninteresting
self.fd = tk.LabelFrame(self,
text = 'Select one')
self.fd.grid(padx = 10)
self.thumbsup = ImageTk.PhotoImage(Image.open('/Users/wkiri/Research/IMBUE/git/src/demud/fig-thumbs-up.png'))
self.thumbsdown = ImageTk.PhotoImage(Image.open('/Users/wkiri/Research/IMBUE/git/src/demud/fig-thumbs-down.png'))
self.interButton = tk.Button(self.fd,
text = 'Interesting',
compound = tk.LEFT,
image = self.thumbsup,
command = self.chooseInteresting)
self.interButton.grid(row=0, column = 0)
self.maybeButton = tk.Button(self.fd,
text = 'Maybe',
command = self.chooseMaybe)
self.maybeButton.grid(row=0, column = 1)
self.unintButton = tk.Button(self.fd,
text = 'Uninteresting',
compound = tk.RIGHT,
image = self.thumbsdown,
command = self.chooseUninteresting)
self.unintButton.grid(row=0, column = 2)
# Create the quit button
self.quitButton = tk.Button(self,
text = 'Quit',
command = self.quit,
background = '#fcc')
self.quitButton.grid(ipadx = 30,
pady = 10)
# Main script
示例14: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def __init__(self):
root = tk.Tk()
root.title('OpenCV Demo')
self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
self.win.pack(fill=tk.BOTH, expand=1)
left = tk.Frame(win)
right = tk.Frame(win)
win.add(left)
win.add(right)
scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
scrollbar.config(command=demos_lb.yview)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self.samples = {}
for fn in glob('*.py'):
name = splitfn(fn)[1]
if fn[0] != '_' and name not in exclude_list:
demos_lb.insert(tk.END, name)
self.samples[name] = fn
demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)
self.cmd_entry = cmd_entry = tk.Entry(right)
cmd_entry.bind('<Return>', self.on_run)
run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)
self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
self.linker = linker = LinkManager(text, self.on_link)
self.text.tag_config("header1", font=('arial', 14, 'bold'))
self.text.tag_config("header2", font=('arial', 12, 'bold'))
text.config(state='disabled')
text.pack(fill='both', expand=1, side=tk.BOTTOM)
cmd_entry.pack(fill='x', side='left' , expand=1)
run_btn.pack()
示例15: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import RIGHT [as 别名]
def __init__(self):
root = tk.Tk()
root.title('OpenCV Demo')
self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
self.win.pack(fill=tk.BOTH, expand=1)
left = tk.Frame(win)
right = tk.Frame(win)
win.add(left)
win.add(right)
scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
scrollbar.config(command=demos_lb.yview)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self.samples = {}
for fn in glob('*.py'):
name = splitfn(fn)[1]
if fn[0] != '_' and name not in exclude_list:
self.samples[name] = fn
for name in sorted(self.samples):
demos_lb.insert(tk.END, name)
demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)
self.cmd_entry = cmd_entry = tk.Entry(right)
cmd_entry.bind('<Return>', self.on_run)
run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)
self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
self.linker = linker = LinkManager(text, self.on_link)
self.text.tag_config("header1", font=('arial', 14, 'bold'))
self.text.tag_config("header2", font=('arial', 12, 'bold'))
text.config(state='disabled')
text.pack(fill='both', expand=1, side=tk.BOTTOM)
cmd_entry.pack(fill='x', side='left' , expand=1)
run_btn.pack()