本文整理汇总了Python中six.moves.tkinter.Frame类的典型用法代码示例。如果您正苦于以下问题:Python Frame类的具体用法?Python Frame怎么用?Python Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _create_buttons
def _create_buttons(self):
frame = Frame(self)
self._create_button(frame, self._left_button,
self._left_button_clicked)
self._create_button(frame, self._right_button,
self._right_button_clicked)
frame.pack()
开发者ID:userzimmermann,项目名称:robotframework-python3,代码行数:7,代码来源:dialogs_py.py
示例2: _create_body
def _create_body(self, message, value, **extra):
frame = Frame(self)
Label(frame, text=message, anchor=W, justify=LEFT, wraplength=800).pack(fill=BOTH)
selector = self._create_selector(frame, value, **extra)
if selector:
selector.pack(fill=BOTH)
selector.focus_set()
frame.pack(padx=5, pady=5, expand=1, fill=BOTH)
开发者ID:userzimmermann,项目名称:robotframework-python3,代码行数:8,代码来源:dialogs_py.py
示例3: __init__
def __init__(self, *args, **kwargs):
Frame.__init__(self, *args, **kwargs)
self.__label = Label(self)
self.__label.pack(side=LEFT)
self.__entry = Entry(self)
self.__entry.pack(fill=X, expand=YES)
self.__checker_function = None
self.__image = None
开发者ID:VanDeng95,项目名称:WaveSyn,代码行数:8,代码来源:tk.py
示例4: _init_paging
def _init_paging(self, parent):
innerframe = Frame(parent, background=self._BACKGROUND_COLOUR)
self.prev = prev = Button(innerframe, text='Previous', command=self.previous, width='10', borderwidth=1, highlightthickness=1, state='disabled')
prev.pack(side='left', anchor='center')
self.next = next = Button(innerframe, text='Next', command=self.__next__, width='10', borderwidth=1, highlightthickness=1, state='disabled')
next.pack(side='right', anchor='center')
innerframe.pack(side='top', fill='y')
self.current_page = 0
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:8,代码来源:concordance_app.py
示例5: _make_buttons
def _make_buttons(self):
'''Create action buttons at the bottom.'''
button_row = self.my_grid.size + self.Y_PADDING + (self.BUTTON_PANEL_HEIGHT - 2 * self.BUTTON_PADDING)
button_frame = Frame(self)
button_frame.place(x=self.my_grid.size - self.X_PADDING, y=button_row)
self.play_game_button = Button(button_frame, text="Play")
self.play_game_button.pack(side=LEFT, padx=self.BUTTON_PADDING, pady=self.BUTTON_PADDING)
开发者ID:boompig,项目名称:pyBattleShip,代码行数:9,代码来源:mock1.py
示例6: __init__
def __init__(self, master):
'''Create the UI for a game of battleship.'''
Frame.__init__(self, master)
self._create_ui()
# these are 'controller' elements that should really be in another class
self.ai = ShipAI(self.their_grid._model, self.my_grid._model)
self.reset()
开发者ID:boompig,项目名称:pyBattleShip,代码行数:10,代码来源:mock1.py
示例7: _init_corpus_select
def _init_corpus_select(self, parent):
innerframe = Frame(parent, background=self._BACKGROUND_COLOUR)
self.var = StringVar(innerframe)
self.var.set(self.model.DEFAULT_CORPUS)
Label(innerframe, justify=LEFT, text=' Corpus: ', background=self._BACKGROUND_COLOUR, padx = 2, pady = 1, border = 0).pack(side='left')
other_corpora = list(self.model.CORPORA.keys()).remove(self.model.DEFAULT_CORPUS)
om = OptionMenu(innerframe, self.var, self.model.DEFAULT_CORPUS, command=self.corpus_selected, *self.model.non_default_corpora())
om['borderwidth'] = 0
om['highlightthickness'] = 1
om.pack(side='left')
innerframe.pack(side='top', fill='x', anchor='n')
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:12,代码来源:collocations_app.py
示例8: _init_feedback
def _init_feedback(self, parent):
self._feedbackframe = feedbackframe = Frame(parent)
feedbackframe.pack(fill='x', side='bottom', padx=3, pady=3)
self._lastoper_label = Label(feedbackframe, text='Last Operation:',
font=self._font)
self._lastoper_label.pack(side='left')
lastoperframe = Frame(feedbackframe, relief='sunken', border=1)
lastoperframe.pack(fill='x', side='right', expand=1, padx=5)
self._lastoper1 = Label(lastoperframe, foreground='#007070',
background='#f0f0f0', font=self._font)
self._lastoper2 = Label(lastoperframe, anchor='w', width=30,
foreground='#004040', background='#f0f0f0',
font=self._font)
self._lastoper1.pack(side='left')
self._lastoper2.pack(side='left', fill='x', expand=1)
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:15,代码来源:rdparser_app.py
示例9: __init__
def __init__(self, image, initialField, initialText):
frm = Frame(root)
frm.config(background="white")
self.image = PhotoImage(format='gif',data=images[image.upper()])
self.imageDimmed = PhotoImage(format='gif',data=images[image])
self.img = Label(frm)
self.img.config(borderwidth=0)
self.img.pack(side = "left")
self.fld = Text(frm, **fieldParams)
self.initScrollText(frm,self.fld,initialField)
frm = Frame(root)
self.txt = Text(frm, **textParams)
self.initScrollText(frm,self.txt,initialText)
for i in range(2):
self.txt.tag_config(colors[i], background = colors[i])
self.txt.tag_config("emph"+colors[i], foreground = emphColors[i])
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:16,代码来源:nemo_app.py
示例10: _init_widgets
def _init_widgets(self, parent):
self.main_frame = Frame(parent, dict(background=self._BACKGROUND_COLOUR, padx=1, pady=1, border=1))
self._init_corpus_select(self.main_frame)
self._init_results_box(self.main_frame)
self._init_paging(self.main_frame)
self._init_status(self.main_frame)
self.main_frame.pack(fill='both', expand=True)
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:7,代码来源:collocations_app.py
示例11: configure
def configure(self, cnf={}, **kw):
"""
Configure this widget. Use ``label_*`` to configure all
labels; and ``listbox_*`` to configure all listboxes. E.g.:
>>> mlb = MultiListbox(master, 5)
>>> mlb.configure(label_foreground='red')
>>> mlb.configure(listbox_foreground='red')
"""
cnf = dict(list(cnf.items()) + list(kw.items()))
for (key, val) in list(cnf.items()):
if key.startswith('label_') or key.startswith('label-'):
for label in self._labels:
label.configure({key[6:]: val})
elif key.startswith('listbox_') or key.startswith('listbox-'):
for listbox in self._listboxes:
listbox.configure({key[8:]: val})
else:
Frame.configure(self, {key:val})
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:19,代码来源:table.py
示例12: set_matplotlib_style
def set_matplotlib_style(self, style_name=''):
import matplotlib.pyplot as plt
if style_name is self.constants.ASK_DIALOG:
dialog = True
else:
dialog = False
ret = [None]
if dialog:
win = Toplevel()
Label(win, text='Select a style for newly-created figures.').pack()
combo = Combobox(win, stat='readonly')
combo['values'] = plt.style.available
combo.current(0)
combo.pack()
ret = [None]
def on_ok():
ret[0] = combo.get()
win.quit()
def on_cancel():
win.quit()
frame = Frame(win)
frame.pack()
Button(win, text='Cancel', command=on_cancel).pack(side='right')
Button(win, text='Ok', command=on_ok).pack(side='right')
win.protocol('WM_DELETE_WINDOW', win.quit)
win.focus_set()
win.grab_set()
win.mainloop()
win.destroy()
style = ret[0] if ret[0] is not None else style_name
plt.style.use(style)
开发者ID:VanDeng95,项目名称:WaveSyn,代码行数:41,代码来源:application.py
示例13: __init__
def __init__(self, package_name, base_class, display_base_class=False):
self.__package_name = package_name
self.__base_class = base_class
self.__display_base_class = display_base_class
self.__window = window = Toplevel()
window.title('Class Selector')
self.__selected_class_name = ''
self.__selected_module_name = ''
self.__tree = tree = ScrolledTree(window)
tree.pack()
# If a module print something while being loaded, the stdout of this
# script will be contaminated.
# The dumb_stream prevents the contamination.
with dumb_stream():
classes = self.load_modules()
for package in classes:
packageNode = tree.insert('', 'end', text=package)
for class_name in classes[package]:
tree.insert(packageNode, 'end', text=class_name, values=package)
button_frame = Frame(window)
button_frame.pack()
def _on_click(module_name, class_name):
self.__selected_module_name = module_name
self.__selected_class_name = class_name
window.destroy()
cancel_button = Button(button_frame, text='Cancel', command=lambda: _on_click('', ''))
cancel_button.pack(side='right')
ok_button = Button(
button_frame,
text='OK',
command=lambda: _on_click(
tree.item(tree.selection(), 'values')[0],
tree.item(tree.selection(), 'text')
)
)
ok_button.pack(side='right')
开发者ID:xialulee,项目名称:WaveSyn,代码行数:38,代码来源:classselector.py
示例14: __init__
def __init__(self, grammar, text):
self._grammar = grammar
self._text = text
# Set up the main window.
self._top = Tk()
self._top.title('Context Free Grammar Demo')
# Base font size
self._size = IntVar(self._top)
self._size.set(12) # = medium
# Set up the key bindings
self._init_bindings(self._top)
# Create the basic frames
frame1 = Frame(self._top)
frame1.pack(side='left', fill='y', expand=0)
self._init_menubar(self._top)
self._init_buttons(self._top)
self._init_grammar(frame1)
self._init_treelet(frame1)
self._init_workspace(self._top)
开发者ID:prz3m,项目名称:kind2anki,代码行数:23,代码来源:cfg.py
示例15: ask_font
def ask_font():
win = Toplevel()
win.title('Font Dialog')
buttonFrame = Frame(win)
retval = [None]
def onClick(ret=None):
win.destroy()
retval[0] = ret
buttonFrame.pack(side=BOTTOM)
btnCancel = Button(buttonFrame, text='Cancel', command=lambda: onClick())
btnCancel.pack(side=RIGHT)
btnOk = Button(buttonFrame, text='OK', command=lambda: onClick((fontFrame.face, fontFrame.size)))
btnOk.pack(side=RIGHT)
fontFrame = FontFrame(win)
fontFrame.pack()
win.focus_set()
win.grab_set()
win.wait_window()
return retval[0]
开发者ID:VanDeng95,项目名称:WaveSyn,代码行数:23,代码来源:tk.py
示例16: __init__
def __init__(self, *args, **kwargs):
Frame.__init__(self, *args, **kwargs)
Observable.__init__(self)
self._text = text = Text(self, wrap=NONE, height=1.2, relief=SOLID)
text.bind('<Configure>', self._on_resize)
text.bind('<KeyPress>', self._on_key_press)
text.pack(fill=X, expand=YES, side=LEFT)
self._default_cursor = text['cursor']
self._default_background_color = text['background']
# Browse Button
text.tag_config('browse_button', foreground='orange')
text.tag_bind('browse_button', '<Button-1>', self._on_button_click)
text.tag_bind('browse_button', '<Enter>',
lambda *args: self._change_cursor_to_hand(True))
text.tag_bind('browse_button', '<Leave>',
lambda *args: self._change_cursor_to_hand(False))
# End Browse Button
self._blank_len = 2
self._browse_text = 'BROWSE'
self._coding = sys.getfilesystemencoding()
self._directory = None
开发者ID:hekejian,项目名称:WaveSyn,代码行数:24,代码来源:tk.py
示例17: _init_query_box
def _init_query_box(self, parent):
innerframe = Frame(parent, background=self._BACKGROUND_COLOUR)
another = Frame(innerframe, background=self._BACKGROUND_COLOUR)
self.query_box = Entry(another, width=60)
self.query_box.pack(side='left', fill='x', pady=25, anchor='center')
self.search_button = Button(another, text='Search', command=self.search, borderwidth=1, highlightthickness=1)
self.search_button.pack(side='left', fill='x', pady=25, anchor='center')
self.query_box.bind('<KeyPress-Return>', self.search_enter_keypress_handler)
another.pack()
innerframe.pack(side='top', fill='x', anchor='n')
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:10,代码来源:concordance_app.py
示例18: _init_results_box
def _init_results_box(self, parent):
innerframe = Frame(parent)
i1 = Frame(innerframe)
i2 = Frame(innerframe)
vscrollbar = Scrollbar(i1, borderwidth=1)
hscrollbar = Scrollbar(i2, borderwidth=1, orient='horiz')
self.results_box = Text(i1,
font=Font(family='courier', size='16'),
state='disabled', borderwidth=1,
yscrollcommand=vscrollbar.set,
xscrollcommand=hscrollbar.set, wrap='none', width='40', height = '20', exportselection=1)
self.results_box.pack(side='left', fill='both', expand=True)
vscrollbar.pack(side='left', fill='y', anchor='e')
vscrollbar.config(command=self.results_box.yview)
hscrollbar.pack(side='left', fill='x', expand=True, anchor='w')
hscrollbar.config(command=self.results_box.xview)
#there is no other way of avoiding the overlap of scrollbars while using pack layout manager!!!
Label(i2, text=' ', background=self._BACKGROUND_COLOUR).pack(side='left', anchor='e')
i1.pack(side='top', fill='both', expand=True, anchor='n')
i2.pack(side='bottom', fill='x', anchor='s')
innerframe.pack(side='top', fill='both', expand=True)
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:21,代码来源:collocations_app.py
示例19: __init__
def __init__(self, *args, **kwargs):
TkToolWindow.__init__(self, *args, **kwargs)
Observable.__init__(self)
self.__serialmap = None
# Temporarily
self.inst = Inst()
# End Temporarily
#window = self.tk_object
tooltab = Frame(self._tool_tabs)
self._tool_tabs.add(tooltab, text='SPI')
#tooltab.pack(expand='yes', fill='x')
# Group OPEN
open_group = Group(tooltab)
open_group.name = 'Open Device'
open_group.pack(side='left', fill='y', expand='yes')
self.__dev_combo = dev_combo = Combobox(open_group, value=[], takefocus=1, stat='readonly', width=12)
dev_combo.bind('<<ComboboxSelected>>', self._on_dev_change)
self.__current_serialno = None
dev_combo.pack(side='top')
self.__is_opened = IntVar(0)
self.__open_check = open_check = Checkbutton(open_group, text='Open',
variable=self.__is_opened,
command=self._on_open_click)
open_check.pack(expand='yes', fill='y', side='top')
# End Group Open
# Group Parameters
param_group = Group(tooltab)
param_group.name = 'Parameters'
param_group.pack(side='left')
Button(param_group, text='Configure', command=self._on_param_change).pack(side='bottom')
param_frame = Frame(param_group)
param_frame.pack()
self.__CPOL = CPOL = IntVar(0)
self.__CPHA = CPHA = IntVar(0)
Checkbutton(param_frame, text='CPOL', variable=CPOL).grid(row=0, column=0)
Checkbutton(param_frame, text='CPHA', variable=CPHA).grid(row=1, column=0)
self.__baud_combo = baud_combo = Combobox(param_frame, value=[], takefocus=1, stat='readonly', width=8)
baud_combo.grid(row=0, column=1, columnspan=2)
self.__read_timeout_str = r_timeout = StringVar()
self.__write_timeout_str = w_timeout = StringVar()
Entry(param_frame, textvariable=r_timeout, width=5).grid(row=1, column=1)
Entry(param_frame, textvariable=w_timeout, width=5).grid(row=1, column=2)
# End Group Parameters
# Write Group
write_group = Group(tooltab)
write_group.name = 'Write'
write_group.pack(side='left', fill='y', expand='yes')
self.__writebuf = writebuf = StringVar()
Entry(write_group, textvariable=writebuf).pack()
Button(write_group, text='Write', command=self._on_write_click).pack()
# End Write Group
self._make_window_manager_tab()
# To Do: a driver group for loading specified spi bus driver
converter = USBSPIConverter()
converter.add_observer(self)
self.add_observer(converter)
开发者ID:xialulee,项目名称:WaveSyn,代码行数:71,代码来源:spibuswindow.py
示例20: init_gui
def init_gui(self):
"""init helper"""
window = PanedWindow(self.root, orient="vertical")
window.pack(side=TOP, fill=BOTH, expand=True)
top_pane = Frame(window)
window.add(top_pane)
mid_pane = Frame(window)
window.add(mid_pane)
bottom_pane = Frame(window)
window.add(bottom_pane)
#setting up frames
top_frame = Frame(top_pane)
mid_frame = Frame(top_pane)
history_frame = Frame(top_pane)
radio_frame = Frame(mid_pane)
rating_frame = Frame(mid_pane)
res_frame = Frame(mid_pane)
check_frame = Frame(bottom_pane)
msg_frame = Frame(bottom_pane)
btn_frame = Frame(bottom_pane)
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=X)
rating_frame.pack(side=TOP, fill=X)
res_frame.pack(side=TOP, fill=BOTH, expand=True)
check_frame.pack(side=TOP, fill=X)
msg_frame.pack(side=TOP, fill=BOTH, expand=True)
btn_frame.pack(side=TOP, fill=X)
# Binding F5 application-wide to run lint
self.root.bind('<F5>', self.run_lint)
#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.lb_messages = Listbox(
msg_frame,
yscrollcommand=rightscrollbar.set,
xscrollcommand=bottomscrollbar.set,
bg="white")
self.lb_messages.bind("<Double-Button-1>", self.show_sourcefile)
self.lb_messages.pack(expand=True, fill=BOTH)
rightscrollbar.config(command=self.lb_messages.yview)
bottomscrollbar.config(command=self.lb_messages.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)
#labelbl_ratingls
lbl_rating_label = Label(rating_frame, text='Rating:')
lbl_rating_label.pack(side=LEFT)
lbl_rating = Label(rating_frame, textvariable=self.rating)
lbl_rating.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.txt_module = Entry(top_frame, background='white')
self.txt_module.bind('<Return>', self.run_lint)
self.txt_module.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)
#.........这里部分代码省略.........
开发者ID:173210,项目名称:depot_tools,代码行数:101,代码来源:gui.py
注:本文中的six.moves.tkinter.Frame类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论