本文整理汇总了Python中tkinter.SOLID属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.SOLID属性的具体用法?Python tkinter.SOLID怎么用?Python tkinter.SOLID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.SOLID属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def build(self, property_dict):
for c in self.interior.winfo_children():
c.destroy()
# Filter property dict
property_dict = {k: v for k, v in property_dict.items()
if self._key_filter_function(k)}
# Prettify key/value pairs for display
property_dict = {self._make_key_pretty(k): self._make_value_pretty(v)
for k, v in property_dict.items()}
# Sort by key and filter
dict_values = sorted(property_dict.items(), key=lambda x: x[0])
for n,(k,v) in enumerate(dict_values):
tk.Label(self.interior, text=k, borderwidth=1, relief=tk.SOLID,
wraplength=75, anchor=tk.E, justify=tk.RIGHT).grid(
row=n, column=0, sticky='nesw', padx=1, pady=1, ipadx=1)
tk.Label(self.interior, text=v, borderwidth=1,
wraplength=125, anchor=tk.W, justify=tk.LEFT).grid(
row=n, column=1, sticky='nesw', padx=1, pady=1, ipadx=1)
示例2: showtip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def showtip(self, text):
"Display text in tooltip window"
self.text = text
if self.tipwindow or not self.text:
return
x, y, _, _ = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 27
y = y + self.widget.winfo_rooty()
self.tipwindow = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
try:
# For Mac OS
tw.tk.call("::tk::unsupported::MacWindowStyle",
"style", tw._w,
"help", "noActivates")
except tk.TclError:
pass
label = tk.Label(tw, text=self.text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1)
label.pack(ipadx=1)
示例3: show_tip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def show_tip(self, tip_text):
"Display text in a tooltip window"
if self.tip_window or not tip_text:
return
x, y, _cx, cy = self.widget.bbox("insert") # get size of widget
x = x + self.widget.winfo_rootx() + 25 # calculate to display tooltip
y = y + cy + self.widget.winfo_rooty() + 25 # below and to the right
self.tip_window = tw = tk.Toplevel(self.widget) # create new tooltip window
tw.wm_overrideredirect(True) # remove all Window Manager (wm) decorations
# tw.wm_overrideredirect(False) # uncomment to see the effect
tw.wm_geometry("+%d+%d" % (x, y)) # create window size
label = tk.Label(tw, text=tip_text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
font=("tahoma", "8", "normal"))
label.pack(ipadx=1)
示例4: showtip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def showtip(self, text):
"Display text in tooltip window"
self.text = text
if self.tipwindow or not self.text:
return
x, y, _cx, cy = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 27
y = y + cy + self.widget.winfo_rooty() +27
self.tipwindow = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
label = tk.Label(tw, text=self.text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
font=("tahoma", "8", "normal"))
label.pack(ipadx=1)
示例5: showtip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def showtip(self, text):
"Display text in a ToolTip window"
self.text = text
if self.tipwindow or not self.text: return
try:
x, y, _cx, cy = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 25
y = y + cy + self.widget.winfo_rooty() +25
self.tipwindow = tw = tk.Toplevel(self.widget)
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
label = tk.Label(tw, text=self.text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
font=("tahoma", "8", "normal"))
label.pack(ipadx=1)
except: pass
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:18,代码来源:GUI_FallDown.py
示例6: showtip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def showtip(self, text):
"Display text in tooltip window"
self.text = text
if self.tipwindow or not self.text:
return
x, y, _, _ = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 27
y = y + self.widget.winfo_rooty()
self.tipwindow = tw = Tk.Toplevel(self.widget)
tw.wm_overrideredirect(1)
tw.wm_geometry("+%d+%d" % (x, y))
try:
# For Mac OS
tw.tk.call("::tk::unsupported::MacWindowStyle",
"style", tw._w,
"help", "noActivates")
except Tk.TclError:
pass
label = Tk.Label(tw, text=self.text, justify=Tk.LEFT,
background="#ffffe0", relief=Tk.SOLID, borderwidth=1)
label.pack(ipadx=1)
示例7: add_info
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def add_info(self, frame):
""" Plugin information """
gui_style = ttk.Style()
gui_style.configure('White.TFrame', background='#FFFFFF')
gui_style.configure('Header.TLabel',
background='#FFFFFF',
font=get_config().default_font + ("bold", ))
gui_style.configure('Body.TLabel',
background='#FFFFFF')
info_frame = ttk.Frame(frame, style='White.TFrame', relief=tk.SOLID)
info_frame.pack(fill=tk.X, side=tk.TOP, expand=True, padx=10, pady=10)
label_frame = ttk.Frame(info_frame, style='White.TFrame')
label_frame.pack(padx=5, pady=5, fill=tk.X, expand=True)
for idx, line in enumerate(self.header_text.splitlines()):
if not line:
continue
style = "Header.TLabel" if idx == 0 else "Body.TLabel"
info = ttk.Label(label_frame, text=line, style=style, anchor=tk.W)
info.bind("<Configure>", self._adjust_wraplength)
info.pack(fill=tk.X, padx=0, pady=0, expand=True, side=tk.TOP)
示例8: showtip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def showtip(self, text, parenleft, parenright):
"""Show the calltip, bind events which will close it and reposition it.
"""
# Only called in CallTips, where lines are truncated
self.text = text
if self.tipwindow or not self.text:
return
self.widget.mark_set(MARK_RIGHT, parenright)
self.parenline, self.parencol = map(
int, self.widget.index(parenleft).split("."))
self.tipwindow = tw = Toplevel(self.widget)
self.position_window()
# remove border on calltip window
tw.wm_overrideredirect(1)
try:
# This command is only needed and available on Tk >= 8.4.0 for OSX
# Without it, call tips intrude on the typing process by grabbing
# the focus.
tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w,
"help", "noActivates")
except TclError:
pass
self.label = Label(tw, text=self.text, justify=LEFT,
background="#ffffe0", relief=SOLID, borderwidth=1,
font = self.widget['font'])
self.label.pack()
tw.lift() # work around bug in Tk 8.5.18+ (issue #24570)
self.checkhideid = self.widget.bind(CHECKHIDE_VIRTUAL_EVENT_NAME,
self.checkhide_event)
for seq in CHECKHIDE_SEQUENCES:
self.widget.event_add(CHECKHIDE_VIRTUAL_EVENT_NAME, seq)
self.widget.after(CHECKHIDE_TIME, self.checkhide_event)
self.hideid = self.widget.bind(HIDE_VIRTUAL_EVENT_NAME,
self.hide_event)
for seq in HIDE_SEQUENCES:
self.widget.event_add(HIDE_VIRTUAL_EVENT_NAME, seq)
示例9: show_tooltip
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def show_tooltip(self):
if self.tip_text:
x_left = self.widget.winfo_rootx() # get widget top-left coordinates
y_top = self.widget.winfo_rooty() - 18 # place tooltip above widget or it flickers
self.tip_window = tk.Toplevel(self.widget) # create Toplevel window; parent=widget
self.tip_window.overrideredirect(True) # remove surrounding toolbar window
self.tip_window.geometry("+%d+%d" % (x_left, y_top)) # position tooltip
label = tk.Label(self.tip_window, text=self.tip_text, justify=tk.LEFT,
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
font=("tahoma", "8", "normal"))
label.pack(ipadx=1)
示例10: add_toolbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def add_toolbar(self, window):
toolbar = tk.Frame(window, bd=1, relief=tk.RAISED)
self.autoscroll_button = tk.Checkbutton(toolbar, text="Auto Scroll", relief=tk.SOLID,
var=self.autoscroll_enable)
self.autoscroll_button.pack(pady=5)
toolbar.pack(side=tk.TOP, fill=tk.X)
示例11: add_section
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def add_section(frame, title):
""" Add a separator and section title """
sep = ttk.Frame(frame, height=2, relief=tk.SOLID)
sep.pack(fill=tk.X, pady=(5, 0), side=tk.TOP)
lbl = ttk.Label(frame, text=title)
lbl.pack(side=tk.TOP, padx=5, pady=0, anchor=tk.CENTER)
示例12: set_styles
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def set_styles():
""" Set global custom styles """
gui_style = ttk.Style()
gui_style.configure('TLabelframe.Label', foreground="#0046D5", relief=tk.SOLID)
示例13: _add_tooltip_text
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SOLID [as 别名]
def _add_tooltip_text(self, tooltip_window):
tooltip = tk.Text(tooltip_window, relief=tk.SOLID, width=40, wrap=tk.WORD)
height = math.ceil(len(self.text) / 40) + self.text.count('\n')
tooltip.insert(tk.END, self.text)
tooltip.config(state=tk.DISABLED, height=height)
tooltip.pack(ipadx=1)
#end _add_tooltip_text
#end class Tooltip