本文整理汇总了Python中six.moves.tkinter.Frame类的典型用法代码示例。如果您正苦于以下问题:Python Frame类的具体用法?Python Frame怎么用?Python Frame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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)
示例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
示例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
示例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)
示例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()
示例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')
示例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)
示例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])
示例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)
示例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})
示例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)
示例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')
示例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)
示例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]