本文整理汇总了Python中Tkinter.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.HORIZONTAL属性的具体用法?Python Tkinter.HORIZONTAL怎么用?Python Tkinter.HORIZONTAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.HORIZONTAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_slider
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def _make_slider(self, parent, rowidx, label, inival, maxval, res=0.5):
# Create shared variable and set initial value.
tkvar = tk.DoubleVar()
tkvar.set(inival)
# Set a callback for whenever tkvar is changed.
# (The 'command' callback on the SpinBox only applies to the buttons.)
tkvar.trace('w', self._update_callback)
# Create the Label, SpinBox, and Scale objects.
label = tk.Label(parent, text=label)
spbox = tk.Spinbox(parent,
textvariable=tkvar,
from_=0, to=maxval, increment=res)
slide = tk.Scale(parent,
orient=tk.HORIZONTAL,
showvalue=0,
variable=tkvar,
from_=0, to=maxval, resolution=res)
label.grid(row=rowidx, column=0)
spbox.grid(row=rowidx, column=1)
slide.grid(row=rowidx, column=2)
return tkvar
# Find the largest output size that fits within the given bounds and
# matches the aspect ratio of the original source image.
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, master, width=500, height=350,
canvwidth=600, canvheight=500):
TK.Frame.__init__(self, master, width=width, height=height)
self._rootwindow = self.winfo_toplevel()
self.width, self.height = width, height
self.canvwidth, self.canvheight = canvwidth, canvheight
self.bg = "white"
self._canvas = TK.Canvas(master, width=width, height=height,
bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
orient=TK.HORIZONTAL)
self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
self._canvas.configure(xscrollcommand=self.hscroll.set,
yscrollcommand=self.vscroll.set)
self.rowconfigure(0, weight=1, minsize=0)
self.columnconfigure(0, weight=1, minsize=0)
self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
column=0, rowspan=1, columnspan=1, sticky='news')
self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
column=1, rowspan=1, columnspan=1, sticky='news')
self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
column=0, rowspan=1, columnspan=1, sticky='news')
self.reset()
self._rootwindow.bind('<Configure>', self.onResize)
示例3: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, parent, label, status, show, *args, **options):
conf = IGMConfig(config_file='config/igm_alt_config.v3.ini', user_config_file=['config/user_igm_alt_config.v3.ini', 'config/user_igm_alt_config.v2.ini'])
tk.Frame.__init__(self, parent, *args, **options)
fg = conf.rgb("status", "body")
bg = conf.rgb("status", "fill")
self.tk_setPalette(background=bg, foreground=fg, activeBackground=conf.rgb("status", "active_bg"), activeForeground=conf.rgb("status", "active_fg"))
self.show = show
self.title_frame = tk.Frame(self)
self.title_frame.pack(fill="x", expand=1)
ttk.Separator(self.title_frame, orient=tk.HORIZONTAL).pack(fill="x", expand=1)
tk.Label(self.title_frame, text=label, foreground=conf.rgb("status", "label")).pack(side="left", fill="x", expand=0, anchor="w")
self.status_ui = ttkHyperlinkLabel.HyperlinkLabel(self.title_frame, textvariable=status, foreground=fg, background=bg)
self.status_ui.pack(side="left", fill="x", expand=0, anchor="w")
self.toggle_button = tk.Checkbutton(self.title_frame, width=2, text='+', command=self.toggle,
variable=self.show, foreground=conf.rgb("status", "check"))
self.toggle_button.pack(side="right", expand=1, anchor="e")
self.sub_frame = tk.Frame(self, relief="flat", borderwidth=0)
示例4: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, master, factor = 0.5, **kwargs):
self.__scrollableWidgets = []
if 'orient' in kwargs:
if kwargs['orient']== tk.VERTICAL:
self.__orientLabel = 'y'
elif kwargs['orient']== tk.HORIZONTAL:
self.__orientLabel = 'x'
else:
raise Exception("Bad 'orient' argument in scrollbar.")
else:
self.__orientLabel = 'y'
kwargs['command'] = self.onScroll
self.factor = factor
ttk.Scrollbar.__init__(self, master, **kwargs)
示例5: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, master, im, value=128):
tkinter.Frame.__init__(self, master)
self.image = im
self.value = value
self.canvas = tkinter.Canvas(self, width=im.size[0], height=im.size[1])
self.backdrop = ImageTk.PhotoImage(im)
self.canvas.create_image(0, 0, image=self.backdrop, anchor=tkinter.NW)
self.canvas.pack()
scale = tkinter.Scale(self, orient=tkinter.HORIZONTAL, from_=0, to=255,
resolution=1, command=self.update_scale,
length=256)
scale.set(value)
scale.bind("<ButtonRelease-1>", self.redraw)
scale.pack()
# uncomment the following line for instant feedback (might
# be too slow on some platforms)
# self.redraw()
示例6: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, master, image, name, enhancer, lo, hi):
tkinter.Frame.__init__(self, master)
# set up the image
self.tkim = ImageTk.PhotoImage(image.mode, image.size)
self.enhancer = enhancer(image)
self.update("1.0") # normalize
# image window
tkinter.Label(self, image=self.tkim).pack()
# scale
s = tkinter.Scale(self, label=name, orient=tkinter.HORIZONTAL,
from_=lo, to=hi, resolution=0.01,
command=self.update)
s.set(self.value)
s.pack()
示例7: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, master=None, cnf=None, **kwargs):
self.frame = ttk.Frame(master)
self.frame.grid_rowconfigure(0, weight=1)
self.frame.grid_columnconfigure(0, weight=1)
self.xbar = AutoScrollbar(self.frame, orient=tkinter.HORIZONTAL)
self.xbar.grid(row=1, column=0,
sticky=tkinter.E + tkinter.W)
self.ybar = AutoScrollbar(self.frame)
self.ybar.grid(row=0, column=1,
sticky=tkinter.S + tkinter.N)
tkinter.Canvas.__init__(self, self.frame, cnf or {},
xscrollcommand=self.xbar.set,
yscrollcommand=self.ybar.set,
**kwargs)
tkinter.Canvas.grid(self, row=0, column=0,
sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
self.xbar.config(command=self.xview)
self.ybar.config(command=self.yview)
self.bind("<MouseWheel>", self.on_mousewheel)
示例8: plot
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def plot(self):
if len(self.channels) < 1 or len(self.channels) > 2:
print "The device can either operate as oscilloscope (1 channel) or x-y plotter (2 channels). Please operate accordingly."
self._quit()
else:
print "Plotting will start in a new window..."
try:
# Setup Quit button
button = Tkinter.Button(master=self.root, text='Quit', command=self._quit)
button.pack(side=Tkinter.BOTTOM)
# Setup speed and width
self.scale1 = Tkinter.Scale(master=self.root,label="View Width:", from_=3, to=1000, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL)
self.scale2 = Tkinter.Scale(master=self.root,label="Generation Speed:", from_=1, to=200, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL)
self.scale2.pack(side=Tkinter.BOTTOM)
self.scale1.pack(side=Tkinter.BOTTOM)
self.scale1.set(4000)
self.scale2.set(self.scale2['to']-10)
self.root.protocol("WM_DELETE_WINDOW", self._quit)
if len(self.channels) == 1:
self.values = []
else:
self.valuesx = [0 for x in range(4000)]
self.valuesy = [0 for y in range(4000)]
self.root.after(4000, self.draw)
Tkinter.mainloop()
except Exception, err:
print "Error. Try again."
print err
self._quit()
示例9: addpageheader
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def addpageheader(self, parent, header, align=None):
self.addpagerow(parent, header, align=align)
ttk.Separator(parent, orient=tk.HORIZONTAL).grid(columnspan=len(header), padx=10, pady=2, sticky=tk.EW)
示例10: draw_slider
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def draw_slider(self):
# scale to choose iteration to view
self.w = Tk.Scale(
self.options_frame,
from_=0, to=self.num_iters - 1,
orient=Tk.HORIZONTAL,
resolution=1,
font=tkFont.Font(family="Helvetica", size=10),
command=self.update_graphs,
length=200)
if self.curr_pos == self.num_iters - 1 or self.curr_pos == 0 or self.var_ref.get():
self.curr_pos = self.num_iters - 1
self.w.set(self.curr_pos)
self.w.grid(row=0, column=1, padx=5, sticky=Tk.W)
示例11: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def __init__(self, parent):
tk.LabelFrame.__init__(self, parent)
self.af_on = tk.IntVar(value=0)
self.af_on_cb = tk.Checkbutton(self, text="AF Threshold", variable=self.af_on)
self.af_on_cb.grid(row=0, column=0, padx=3, columnspan=2, sticky=tk.EW)
self.af_var = tk.DoubleVar()
self.af_gt_lt = tk.IntVar(value=1)
self.af_lt_radio_button = tk.Radiobutton(self, text="<", variable=self.af_gt_lt, value=1)
self.af_lt_radio_button.grid(row=1, column=0, sticky=tk.EW)
self.af_gt_radio_button = tk.Radiobutton(self, text=">", variable=self.af_gt_lt, value=2)
self.af_gt_radio_button.grid(row=1, column=1, sticky=tk.EW)
self.af_scale = tk.Scale(self, variable=self.af_var, from_=float(0), to=float(1), resolution=float(0.01),
orient=tk.HORIZONTAL)
self.af_scale.grid(row=2, column=0, padx=3, sticky=tk.EW, columnspan=2)
示例12: master_pane
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def master_pane(self):
"""
The home pane.
"""
self.logger.info("%s: activated" % inspect.stack()[0][3])
self.logger.info("%s" % inspect.stack()[1][3])
self.mainframe = ttk.Frame(self.superframe, width=604, height=510)
self.mainframe.grid(column=0, row=2, sticky=(N, W, E, S))
self.mainframe.grid_rowconfigure(0, weight=1)
self.mainframe.grid_rowconfigure(5, weight=1)
self.mainframe.grid_columnconfigure(0, weight=1)
self.mainframe.grid_columnconfigure(2, weight=1)
self.change_state_btn = ttk.Button(self.mainframe, width=20, text="Change State", command=self.change_state)
self.change_state_btn.grid(column=0, row=80, pady=4, columnspan=3)
self.change_state_btn.configure(state=self.state_button_state)
self.info_status_label = ttk.Label(self.mainframe, text='Location of keyfile:')
self.info_status_label.grid(column=0, row=90, pady=8, columnspan=3)
ttk.Button(self.mainframe, width=20, text="Retrieve from JSS Script", command=self.jss_pane).grid(column=0, row=100, pady=4, columnspan=3)
ttk.Button(self.mainframe, width=20, text="Fetch from Remote Volume", command=self.remote_nav_pane).grid(column=0, row=200, pady=4, columnspan=3)
ttk.Button(self.mainframe, width=20, text="Retrieve from Local Volume", command=self.local_nav_pane).grid(column=0, row=300, pady=4, columnspan=3)
ttk.Button(self.mainframe, width=20, text="Enter Firmware Password", command=self.direct_entry_pane).grid(column=0, row=320, pady=4, columnspan=3)
ttk.Separator(self.mainframe, orient=HORIZONTAL).grid(row=400, columnspan=3, sticky=(E, W), pady=8)
hash_display = ttk.Entry(self.mainframe, width=58, textvariable=self.hashed_results)
hash_display.grid(column=0, row=450, columnspan=4)
self.hash_btn = ttk.Button(self.mainframe, width=20, text="Copy hash to clipboard", command=self.copy_hash)
self.hash_btn.grid(column=0, row=500, pady=4, columnspan=3)
self.hash_btn.configure(state=self.hash_button_state)
ttk.Separator(self.mainframe, orient=HORIZONTAL).grid(row=700, columnspan=3, sticky=(E, W), pady=8)
self.status_label = ttk.Label(self.mainframe, textvariable=self.status_string)
self.status_label.grid(column=0, row=2100, sticky=W, columnspan=2)
ttk.Button(self.mainframe, text="Quit", width=6, command=self.root.destroy).grid(column=2, row=2100, sticky=E)
开发者ID:univ-of-utah-marriott-library-apple,项目名称:firmware_password_manager,代码行数:45,代码来源:Skeleton_Key.py
示例13: remote_nav_pane
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def remote_nav_pane(self):
"""
Connect to server and select keyfile.
"""
self.logger.info("%s: activated" % inspect.stack()[0][3])
self.mainframe.grid_remove()
try:
if self.config_options["keyfile"]["remote_type"] == 'smb':
if self.config_options["keyfile"]["server_path"]:
self.remote_hostname.set(self.config_options["keyfile"]["server_path"])
if self.config_options["keyfile"]["username"]:
self.remote_username.set(self.config_options["keyfile"]["username"])
if self.config_options["keyfile"]["password"]:
self.remote_password.set(self.config_options["keyfile"]["password"])
except:
pass
self.remote_nav_frame = ttk.Frame(self.superframe, width=604, height=510)
self.remote_nav_frame.grid(column=0, row=2, sticky=(N, W, E, S))
self.remote_nav_frame.grid_columnconfigure(0, weight=1)
self.remote_nav_frame.grid_columnconfigure(1, weight=1)
self.remote_nav_frame.grid_columnconfigure(2, weight=1)
self.remote_nav_frame.grid_columnconfigure(3, weight=1)
ttk.Label(self.remote_nav_frame, text="Read keyfile from remote server: (ie smb://...)").grid(column=0, row=100, columnspan=4, sticky=(E, W))
ttk.Label(self.remote_nav_frame, text="Server path:").grid(column=0, row=150, sticky=E)
hname_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_hostname)
hname_entry.grid(column=1, row=150, sticky=W, columnspan=2)
ttk.Label(self.remote_nav_frame, text="Username:").grid(column=0, row=200, sticky=E)
uname_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_username)
uname_entry.grid(column=1, row=200, sticky=W, columnspan=2)
ttk.Label(self.remote_nav_frame, text="Password:").grid(column=0, row=250, sticky=E)
pword_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_password, show="*")
pword_entry.grid(column=1, row=250, sticky=W, columnspan=2)
ttk.Button(self.remote_nav_frame, text="Read keyfile", width=15, default='active', command=self.read_remote).grid(column=1, row=300, columnspan=2, pady=12)
ttk.Separator(self.remote_nav_frame, orient=HORIZONTAL).grid(row=1000, columnspan=50, pady=12, sticky=(E, W))
ttk.Button(self.remote_nav_frame, text="Return to home", command=self.master_pane).grid(column=2, row=1100, sticky=E)
ttk.Button(self.remote_nav_frame, text="Quit", width=6, command=self.root.destroy).grid(column=3, row=1100, sticky=W)
开发者ID:univ-of-utah-marriott-library-apple,项目名称:firmware_password_manager,代码行数:50,代码来源:Skeleton_Key.py
示例14: prefs_ui
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def prefs_ui(self, parent):
frame = notebook.Frame(parent)
frame.columnconfigure(1, weight=1)
# Translators: this is shown in the preferences panel
ttkHyperlinkLabel.HyperlinkLabel(frame, text=_(u"EDR website"), background=notebook.Label().cget('background'), url="https://edrecon.com", underline=True).grid(padx=10, sticky=tk.W)
ttkHyperlinkLabel.HyperlinkLabel(frame, text=_(u"EDR community"), background=notebook.Label().cget('background'), url="https://edrecon.com/discord", underline=True).grid(padx=10, sticky=tk.W)
# Translators: this is shown in the preferences panel
notebook.Label(frame, text=_(u'Credentials')).grid(padx=10, sticky=tk.W)
ttk.Separator(frame, orient=tk.HORIZONTAL).grid(columnspan=2, padx=10, pady=2, sticky=tk.EW)
# Translators: this is shown in the preferences panel
cred_label = notebook.Label(frame, text=_(u'Log in with your EDR account for full access (https://edrecon.com/account)'))
cred_label.grid(padx=10, columnspan=2, sticky=tk.W)
notebook.Label(frame, text=_(u"Email")).grid(padx=10, row=11, sticky=tk.W)
notebook.Entry(frame, textvariable=self._email).grid(padx=10, row=11,
column=1, sticky=tk.EW)
notebook.Label(frame, text=_(u"Password")).grid(padx=10, row=12, sticky=tk.W)
notebook.Entry(frame, textvariable=self._password,
show=u'*').grid(padx=10, row=12, column=1, sticky=tk.EW)
notebook.Label(frame, text=_(u'Sitrep Broadcasts')).grid(padx=10, row=14, sticky=tk.W)
ttk.Separator(frame, orient=tk.HORIZONTAL).grid(columnspan=2, padx=10, pady=2, sticky=tk.EW)
notebook.Label(frame, text=_("Redact my info")).grid(padx=10, row = 16, sticky=tk.W)
choices = { _(u'Auto'),_(u'Always'),_(u'Never')}
popupMenu = notebook.OptionMenu(frame, self._anonymous_reports, self.anonymous_reports, *choices)
popupMenu.grid(padx=10, row=16, column=1, sticky=tk.EW)
popupMenu["menu"].configure(background="white", foreground="black")
if self.server.is_authenticated():
if self.is_anonymous():
self.status = _(u"authenticated (guest).")
else:
self.status = _(u"authenticated.")
else:
self.status = _(u"not authenticated.")
# Translators: this is shown in the preferences panel as a heading for feedback options (e.g. overlay, audio cues)
notebook.Label(frame, text=_(u"EDR Feedback:")).grid(padx=10, row=17, sticky=tk.W)
ttk.Separator(frame, orient=tk.HORIZONTAL).grid(columnspan=2, padx=10, pady=2, sticky=tk.EW)
notebook.Checkbutton(frame, text=_(u"Overlay"),
variable=self._visual_feedback).grid(padx=10, row=19,
sticky=tk.W)
notebook.Checkbutton(frame, text=_(u"Sound"),
variable=self._audio_feedback).grid(padx=10, row=20, sticky=tk.W)
return frame
示例15: test
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import HORIZONTAL [as 别名]
def test():
root = tk.Tk()
scrollbar = simultaneousScrollbar(root, orient=tk.HORIZONTAL)
scrollbar.pack(side=tk.TOP, fill=tk.X)
emptySpace = tk.Frame(root, height=18)
emptySpace.pack()
tk.Label(root, text='First scrolled frame:').pack(anchor=tk.W)
canvas1 = tk.Canvas(root, width=300, height=100)
canvas1.pack(anchor=tk.NW)
frame1= tk.Frame(canvas1)
frame1.pack()
for i in range(20):
tk.Label(frame1, text="Label "+str(i)).pack(side=tk.LEFT)
canvas1.create_window(0, 0, window=frame1, anchor='nw')
canvas1.update_idletasks()
canvas1['scrollregion'] = (0,0,frame1.winfo_reqwidth(), frame1.winfo_reqheight())
tk.Label(root, text='Second scrolled frame:').pack(anchor=tk.W)
canvas2 = tk.Canvas(root,width=300, height=100)
canvas2.pack(anchor=tk.NW)
frame2= tk.Frame(canvas2)
frame2.pack()
for i in range(20):
tk.Label(frame2, text="Label "+str(i)).pack(side=tk.LEFT)
canvas2.create_window(0, 0, window=frame2, anchor='nw')
canvas2.update_idletasks()
canvas2['scrollregion'] = (0,0,frame2.winfo_reqwidth(), frame2.winfo_reqheight())
scrollbar.add_ScrollableArea(canvas1,canvas2)
MouseWheel(root).add_scrolling(canvas1, xscrollbar=scrollbar)
MouseWheel(root).add_scrolling(canvas2, xscrollbar=scrollbar)
root.mainloop()