本文整理汇总了Python中tkinter.TOP属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.TOP属性的具体用法?Python tkinter.TOP怎么用?Python tkinter.TOP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.TOP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_figure_window
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def make_figure_window(self):
self.figure_window = tk.Toplevel(self)
self.figure_window.wm_title('Preview')
screen_dpi = self.figure_window.winfo_fpixels('1i')
screen_width = self.figure_window.winfo_screenwidth() # in pixels
figure_width = screen_width / 2 / screen_dpi
figure_height = 0.75 * figure_width
self.figure = Figure(figsize=(figure_width, figure_height),
dpi=screen_dpi)
ax0 = self.figure.add_subplot(221)
axes = [self.figure.add_subplot(220 + i, sharex=ax0, sharey=ax0)
for i in range(2, 5)]
self.axes = np.array([ax0] + axes)
canvas = FigureCanvasTkAgg(self.figure, master=self.figure_window)
canvas.show()
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
toolbar = NavigationToolbar2Tk(canvas, self.figure_window)
toolbar.update()
canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
示例2: create_toolbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def create_toolbar(self):
self.toolbar = ttk.Frame(self.master)
newButton = ttk.Button(self.toolbar, text=NEW, takefocus=False,
image=self.images[NEW], command=self.board.new_game)
TkUtil.Tooltip.Tooltip(newButton, text="New Game")
zoomLabel = ttk.Label(self.toolbar, text="Zoom:")
self.zoomSpinbox = Spinbox(self.toolbar,
textvariable=self.zoom, from_=Board.MIN_ZOOM,
to=Board.MAX_ZOOM, increment=Board.ZOOM_INC, width=3,
justify=tk.RIGHT, validate="all")
self.zoomSpinbox.config(validatecommand=(
self.zoomSpinbox.register(self.validate_int), "%P"))
TkUtil.Tooltip.Tooltip(self.zoomSpinbox, text="Zoom level (%)")
self.shapeCombobox = ttk.Combobox(self.toolbar, width=8,
textvariable=self.shapeName, state="readonly",
values=sorted(Shapes.ShapeForName.keys()))
TkUtil.Tooltip.Tooltip(self.shapeCombobox, text="Tile Shape")
TkUtil.add_toolbar_buttons(self.toolbar, (newButton, None,
zoomLabel, self.zoomSpinbox, self.shapeCombobox))
self.toolbar.pack(side=tk.TOP, fill=tk.X, before=self.board)
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, canvas, num, window):
FigureManagerBase.__init__(self, canvas, num)
self.window = window
self.window.withdraw()
self.set_window_title("Figure %d" % num)
self.canvas = canvas
# If using toolmanager it has to be present when initializing the
# toolbar
self.toolmanager = self._get_toolmanager()
# packing toolbar first, because if space is getting low, last packed
# widget is getting shrunk first (-> the canvas)
self.toolbar = self._get_toolbar()
self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
self._num = num
self.statusbar = None
if self.toolmanager:
backend_tools.add_tools_to_manager(self.toolmanager)
if self.toolbar:
backend_tools.add_tools_to_container(self.toolbar)
self.statusbar = StatusbarTk(self.window, self.toolmanager)
self._shown = False
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, canvas, num, window):
FigureManagerBase.__init__(self, canvas, num)
self.window = window
self.window.withdraw()
self.set_window_title("Figure %d" % num)
self.canvas = canvas
# If using toolmanager it has to be present when initializing the toolbar
self.toolmanager = self._get_toolmanager()
# packing toolbar first, because if space is getting low, last packed widget is getting shrunk first (-> the canvas)
self.toolbar = self._get_toolbar()
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self._num = num
self.statusbar = None
if self.toolmanager:
backend_tools.add_tools_to_manager(self.toolmanager)
if self.toolbar:
backend_tools.add_tools_to_container(self.toolbar)
self.statusbar = StatusbarTk(self.window, self.toolmanager)
self._shown = False
示例5: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, parent, **kwargs):
super().__init__(parent, highlightthickness=0, **kwargs)
vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
vscrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0,
yscrollcommand=vscrollbar.set)
canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
vscrollbar.config(command=canvas.yview)
canvas.xview_moveto(0)
canvas.yview_moveto(0)
self.interior = interior = tk.Frame(canvas)
self.interior_id = canvas.create_window(0, 0,
window=interior,
anchor=tk.NW)
self.interior.bind("<Configure>", self.configure_interior)
self.canvas.bind("<Configure>", self.configure_canvas)
self.scrollbar = vscrollbar
self.mouse_position = 0
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, master):
super().__init__(master, text="Levels", padding=4)
self.lowest_level = Player.levelmeter_lowest
self.pbvar_left = tk.IntVar()
self.pbvar_right = tk.IntVar()
pbstyle = ttk.Style()
# pbstyle.theme_use("classic") # clam, alt, default, classic
pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")
ttk.Label(self, text="dB").pack(side=tkinter.TOP)
frame = ttk.LabelFrame(self, text="L.")
frame.pack(side=tk.LEFT)
self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_left, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_left.pack()
frame = ttk.LabelFrame(self, text="R.")
frame.pack(side=tk.LEFT)
self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_right, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_right.pack()
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, parent, previewname):
logger.debug("Initializing %s: (previewname: '%s')", self.__class__.__name__, previewname)
ttk.Frame.__init__(self, parent)
self.name = previewname
get_images().resize_image(self.name, None)
self.previewimage = get_images().previewtrain[self.name][1]
self.canvas = tk.Canvas(self, bd=0, highlightthickness=0)
self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
self.imgcanvas = self.canvas.create_image(0,
0,
image=self.previewimage,
anchor=tk.NW)
self.bind("<Configure>", self.resize)
logger.debug("Initialized %s:", self.__class__.__name__)
示例8: get_group_frame
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def get_group_frame(self, group):
""" Return a new group frame """
group = group.lower()
if self.group_frames.get(group, None) is None:
logger.debug("Creating new group frame for: %s", group)
is_master = group == "_master"
opts_frame = self.optsframe.subframe
if is_master:
group_frame = ttk.Frame(opts_frame, name=group.lower())
else:
group_frame = ttk.LabelFrame(opts_frame,
text="" if is_master else group.title(),
name=group.lower())
group_frame.pack(side=tk.TOP, fill=tk.X, padx=5, pady=5, anchor=tk.NW)
self.group_frames[group] = dict(frame=group_frame,
chkbtns=self.checkbuttons_frame(group_frame))
group_frame = self.group_frames[group]
return group_frame
示例9: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, parent, tabname, helptext):
logger.debug("Initializing %s: (tabname: '%s', helptext: %s)",
self.__class__.__name__, tabname, helptext)
ttk.Frame.__init__(self, parent)
self.pack(fill=tk.BOTH, side=tk.TOP, anchor=tk.NW)
self.runningtask = parent.runningtask
self.helptext = helptext
self.tabname = tabname
self.vars = {"info": tk.StringVar()}
self.add_optional_vars(self.set_vars())
self.subnotebook = self.add_subnotebook()
self.optsframe = self.add_options_frame()
self.add_options_info()
self.add_frame_separator()
self.set_mainframe_single_tab_style()
parent.add(self, text=self.tabname.title())
logger.debug("Initialized %s", self.__class__.__name__,)
示例10: opts_checkbuttons
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def opts_checkbuttons(self, frame):
""" Add the options check buttons """
logger.debug("Building Check Buttons")
self.add_section(frame, "Display")
for item in ("raw", "trend", "avg", "smoothed", "outliers"):
if item == "avg":
text = "Show Rolling Average"
elif item == "outliers":
text = "Flatten Outliers"
else:
text = "Show {}".format(item.title())
var = tk.BooleanVar()
if item == self.default_view:
var.set(True)
self.vars[item] = var
ctl = ttk.Checkbutton(frame, variable=var, text=text)
ctl.pack(side=tk.TOP, padx=5, pady=5, anchor=tk.W)
hlp = self.set_help(item)
Tooltip(ctl, text=hlp, wraplength=200)
logger.debug("Built Check Buttons")
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, parent, tk_vars):
logger.debug("Initializing %s: (parent: %s, tk_vars: %s)",
self.__class__.__name__, parent, tk_vars)
super().__init__(parent)
self.pack(expand=True, fill=tk.BOTH, padx=2, pady=2)
self._refresh_display_trigger = tk_vars["refresh"]
self._refresh_display_trigger.trace("w", self._refresh_display_callback)
self._display = parent.preview_display
self._canvas = tk.Canvas(self, bd=0, highlightthickness=0)
self._canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
self._displaycanvas = self._canvas.create_image(0, 0,
image=self._display.tk_image,
anchor=tk.NW)
self.bind("<Configure>", self._resize)
logger.debug("Initialized %s", self.__class__.__name__)
示例12: _build_frame
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def _build_frame(self, parent, config_key):
""" Build the options frame for this command
Parameters
----------
parent: tkinter object
The tkinter object that will hold this configuration frame
config_key: str
The section/plugin key for these configuration options
"""
logger.debug("Add Config Frame")
panel_kwargs = dict(columns=2, option_columns=2, blank_nones=False)
frame = ttk.Frame(self)
frame.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
cp_options = [opt for key, opt in self._options.items() if key != "helptext"]
ControlPanel(frame, cp_options, header_text=None, **panel_kwargs)
self._add_actions(parent, config_key)
logger.debug("Added Config Frame")
示例13: mainloop
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def mainloop(self):
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
from PIL import Image, ImageTk
from ttk import Frame, Button, Style
import time
import socket
self.root = tk.Toplevel() #Tk()
self.root.title('Display')
self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
self.image1 = ImageTk.PhotoImage(self.image)
self.panel1 = tk.Label(self.root, image=self.image1)
self.display = self.image1
self.frame1 = Frame(self.root, height=50, width=50)
self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
self.root.after(100, self.advance_image)
self.root.after(100, self.update_image)
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
#global _started_tkinter_main_loop
#if not _started_tkinter_main_loop:
# _started_tkinter_main_loop = True
# print("Starting Tk main thread...")
示例14: view_init
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def view_init(self):
self.frame = tk.LabelFrame(self.browser.workframe, text=" Image ")
self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
self.figure = plt.figure(figsize=(8, 12), dpi=70)
self.ax1 = plt.subplot2grid((50,40), (0, 0), rowspan=40, colspan=40)
self.ax2 = plt.subplot2grid((50,40), (42, 0), rowspan=8, colspan=40, sharex=self.ax1)
plt.subplots_adjust(left=0.1, bottom=0.05, right=0.95, top=0.97, wspace=0.2, hspace=0.2)
self.view_plot_image()
self.canvas = FigureCanvasTkAgg(self.figure, self.frame)
if self.mpltlib3:
self.canvas.draw()
toolbar = NavigationToolbar2Tk(self.canvas, self.frame).update()
else:
self.canvas.show()
toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame).update()
self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, padx=2, pady=2, expand=True)
self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
示例15: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import TOP [as 别名]
def __init__(self, master, **kwargs):
super().__init__(**kwargs )
self.geometry('350x100')
self.title('Find and Replace')
self.text_to_find = tk.StringVar()
self.text_to_replace_with = tk.StringVar()
top_frame = tk.Frame(self)
middle_frame = tk.Frame(self)
bottom_frame = tk.Frame(self)
find_entry_label = tk.Label(top_frame, text="Find: ")
self.find_entry = ttk.Entry(top_frame, textvar=self.text_to_find)
replace_entry_label = tk.Label(middle_frame, text="Replace: ")
self.replace_entry = ttk.Entry(middle_frame, textvar=self.text_to_replace_with)
self.find_button = ttk.Button(bottom_frame, text="Find", command=self.on_find)
self.replace = ttk.Button(bottom_frame, text="Replace", command=self.on_replace)
self.cancel_button = ttk.Button(bottom_frame, text="Cancel", command=self.destroy)
find_entry_label.pack(side=tk.LEFT, padx=(20, 0))
self.find_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)
replace_entry_label.pack(side=tk.LEFT)
self.replace_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)
self.find_button.pack(side=tk.LEFT, padx=(85, 0))
self.cancel_button.pack(side=tk.RIGHT, padx=(0, 30))
top_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30)
middle_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30)
bottom_frame.pack(side=tk.TOP, expand=1, fill=tk.X)