本文整理汇总了Python中tkinter.SUNKEN属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.SUNKEN属性的具体用法?Python tkinter.SUNKEN怎么用?Python tkinter.SUNKEN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.SUNKEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master):
self.master = master
self.notebk = ttk.Notebook(self.master)
self.notebk.pack()
self.frame1 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
self.frame2 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
self.notebk.add(self.frame1, text = 'One')
self.notebk.add(self.frame2, text = 'Two')
self.btn = ttk.Button(self.frame1, text='Add/Insert Tab at Position 1', command = self.AddTab)
self.btn.pack()
self.btn2 = ttk.Button(self.frame1, text='Disable Tab at Position 1', command = self.disableTab)
self.btn2.pack()
strdisplay = r'Tab ID:{}'.format(self.notebk.select())
ttk.Label(self.frame1, text = strdisplay).pack()
strdisplay2 = 'Tab index:{}'.format(self.notebk.index(self.notebk.select()))
ttk.Label(self.frame1, text = strdisplay2).pack()
示例2: create_statusbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def create_statusbar(self):
statusBar = ttk.Frame(self.master)
statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
anchor=tk.CENTER)
self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1)
TkUtil.Tooltip.Tooltip(self.modifiedLabel,
text="MOD if the text has unsaved changes")
self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
anchor=tk.CENTER)
self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E),
pady=2, padx=1)
TkUtil.Tooltip.Tooltip(self.positionLabel,
text="Current line and column position")
ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E))
statusBar.columnconfigure(0, weight=1)
statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E))
self.set_status_text("Start typing to create a new document or "
"click File→Open")
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master):
Frame.__init__(self, master)
self.config(border=1)
self.msg = Label(self, bd=1, relief=SUNKEN, anchor=W)
self.msg.pack(side='left', expand=True, fill=X)
self.column = Label(self, bd=1, relief=SUNKEN, anchor=W)
self.column.config(text='Col: 0')
self.column.pack(side='right', fill=X)
self.line = Label(self, bd=1, relief=SUNKEN, anchor=W)
self.line.config(text='Line: 1')
self.line.pack(side='right', fill=X)
self.mode = Label(self, bd=1, relief=SUNKEN, anchor=W)
self.mode.config(text='Mode: 1')
self.mode.pack(side='right', fill=X)
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master=None, text="", width=20, compound=tk.LEFT, **kwargs):
"""
Create a ToggledFrame.
:param master: master widget
:type master: widget
:param text: text to display next to the toggle arrow
:type text: str
:param width: width of the closed ToggledFrame (in characters)
:type width: int
:param compound: "center", "none", "top", "bottom", "right" or "left":
position of the toggle arrow compared to the text
:type compound: str
:param kwargs: keyword arguments passed on to the :class:`ttk.Frame` initializer
"""
ttk.Frame.__init__(self, master, **kwargs)
self._open = False
self.__checkbutton_var = tk.BooleanVar()
self._open_image = ImageTk.PhotoImage(Image.open(os.path.join(get_assets_directory(), "open.png")))
self._closed_image = ImageTk.PhotoImage(Image.open(os.path.join(get_assets_directory(), "closed.png")))
self._checkbutton = ttk.Checkbutton(self, style="Toolbutton", command=self.toggle,
variable=self.__checkbutton_var, text=text, compound=compound,
image=self._closed_image, width=width)
self.interior = ttk.Frame(self, relief=tk.SUNKEN)
self._grid_widgets()
示例5: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, parent, payment_option, **kwargs):
super().__init__(parent, **kwargs)
self._payment_type = tk.Label(self,
text=payment_option,
font=self.font,
width=15,
relief=tk.SUNKEN,
bd=2)
self._remove_bt = lib.LabelButton(self, "remove",
command=self.remove,
font=self.font)
self._payment_type.grid(row=0, column=0, sticky="nswe",
pady=2, padx=2, ipady=2, ipadx=2)
self._remove_bt.grid(row=0, column=1, sticky="nswe",
pady=2, padx=2, ipadx=2, ipady=2)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [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)
示例7: _color_control
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def _color_control(self):
""" Clickable label holding the currently selected color """
logger.debug("Add control to Options Frame: (widget: '%s', control: %s, choices: %s)",
self.option.name, self.option.control, self.option.choices)
frame = ttk.Frame(self.frame)
ctl = tk.Frame(frame,
bg=self.option.default,
bd=2,
cursor="hand2",
relief=tk.SUNKEN,
width=round(int(20 * get_config().scaling_factor)),
height=round(int(12 * get_config().scaling_factor)))
ctl.bind("<Button-1>", lambda *e, c=ctl, t=self.option.title: self._ask_color(c, t))
ctl.pack(side=tk.LEFT, anchor=tk.W)
lbl = ttk.Label(frame, text=self.option.title, width=self.label_width, anchor=tk.W)
lbl.pack(padx=2, pady=5, side=tk.RIGHT, anchor=tk.N)
frame.pack(side=tk.LEFT, anchor=tk.W)
if self.option.helptext is not None:
_get_tooltip(lbl, text=self.option.helptext, wraplength=600)
logger.debug("Added control to Options Frame: %s", self.option.name)
return ctl
示例8: AddFrame
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def AddFrame(self):
if self.button['text']=='Add frame in Paned Window':
self.frame3 = ttk.Frame(self.panedWindow, width = 50, height=400, relief = tk.SUNKEN)
self.panedWindow.insert(1, self.frame3) # default weight=0
self.button.config(text = 'Remove/Forget Added Frame')
else:
self.panedWindow.forget(1)
self.button.config(text = 'Add frame in Paned Window')
示例9: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master):
tk.Frame.__init__(self, master)
self.variable=tk.StringVar()
self.label=tk.Label(
self, bd=1, relief=tk.SUNKEN, anchor=tk.W,
textvariable=self.variable,
font=('arial', 16, 'normal')
)
self.variable.set('')
self.label.pack(fill=tk.X)
self.pack(fill=tk.BOTH)
示例10: AddTab
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def AddTab(self):
if self.btn['text'] == 'Add/Insert Tab at Position 1':
self.frame3 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
self.notebk.insert(1, self.frame3, text = 'Additional Tab')
self.btn.config(text = 'Remove/Forget Tab')
else:
self.notebk.forget(1)
self.btn.config(text = 'Add/Insert Tab at Position 1')
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master):
self.master = master
self.panedWindow = ttk.Panedwindow(self.master, orient = tk.HORIZONTAL) # orient panes horizontally next to each other
self.panedWindow.pack(fill = tk.BOTH, expand = True) # occupy full master window and enable expand property
self.frame1 = ttk.Frame(self.panedWindow, width = 100, height = 300, relief = tk.SUNKEN)
self.frame2 = ttk.Frame(self.panedWindow, width = 400, height = 400, relief = tk.SUNKEN)
self.panedWindow.add(self.frame1, weight = 1)
self.panedWindow.add(self.frame2, weight = 3)
self.button = ttk.Button(self.frame1, text = 'Add frame in Paned Window', command = self.AddFrame)
self.button.pack()
示例12: create_statusbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def create_statusbar(self):
statusBar = ttk.Frame(self.master)
statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
scoreLabel = ttk.Label(statusBar, textvariable=self.scoreText,
relief=tk.SUNKEN)
scoreLabel.grid(column=1, row=0)
statusBar.columnconfigure(0, weight=1)
statusBar.pack(side=tk.BOTTOM, fill=tk.X)
self.set_status_text("Click a tile or click File→New for a new "
"game")
示例13: create_statusbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def create_statusbar(self):
statusBar = ttk.Frame(self.master)
statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
scoreLabel = ttk.Label(statusBar, textvariable=self.scoreText,
relief=tk.SUNKEN)
scoreLabel.grid(column=1, row=0)
TkUtil.Tooltip.Tooltip(scoreLabel,
text="Current score (High score)")
statusBar.columnconfigure(0, weight=1)
statusBar.pack(side=tk.BOTTOM, fill=tk.X)
self.set_status_text("Click a tile or click File→New for a new "
"game")
示例14: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def __init__(self, master=None, **kwargs):
"""
Create a FontChooser.
:param master: master window
:type master: widget
:param kwargs: keyword arguments passed to :class:`tk.Toplevel` initializer
"""
tk.Toplevel.__init__(self, master, **kwargs)
self.wm_title("Choose a font")
self.resizable(False, False)
self.style = ttk.Style()
self.style.configure("FontChooser.TLabel", font=("default", 11), relief=tk.SUNKEN, anchor=tk.CENTER)
self._font_family_header = ttk.Label(self, text="Font family", style="FontChooser.TLabel")
self._font_family_list = FontFamilyListbox(self, callback=self._on_family, height=8)
self._font_label_variable = tk.StringVar()
self._font_label = ttk.Label(self, textvariable=self._font_label_variable, background="white")
self._font_properties_header = ttk.Label(self, text="Font properties", style="FontChooser.TLabel")
self._font_properties_frame = FontPropertiesFrame(self, callback=self._on_properties, label=False)
self._font_size_header = ttk.Label(self, text="Font size", style="FontChooser.TLabel")
self._size_dropdown = FontSizeDropdown(self, callback=self._on_size, width=4)
self._example_label = tk.Label(self, text="Example", anchor=tk.CENTER, background="white", height=2,
relief=tk.SUNKEN)
self._family = None
self._size = 11
self._bold = False
self._italic = False
self._underline = False
self._overstrike = False
self._font = None
self._ok_button = ttk.Button(self, text="OK", command=self._close)
self._cancel_button = ttk.Button(self, text="Cancel", command=self._cancel)
self._grid_widgets()
示例15: on_click
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SUNKEN [as 别名]
def on_click(self, *args):
if self._active:
self.configure(relief=tk.SUNKEN, fg="black")