本文整理汇总了Python中tkinter.FLAT属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.FLAT属性的具体用法?Python tkinter.FLAT怎么用?Python tkinter.FLAT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.FLAT属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: undock
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def undock(self, dock, x=None, y=None):
"""Warning: On Mac OS X 10.5 undocking works imperfectly.
Left and right docking work fine though.
"""
dock.pack_forget()
dock.config(relief=tk.FLAT, borderwidth=0)
dock.tk.call("wm", "manage", dock)
on_close = dock.register(dock.on_close)
dock.tk.call("wm", "protocol", dock, "WM_DELETE_WINDOW", on_close)
title = dock.title if hasattr(dock, "title") else "Dock"
dock.tk.call("wm", "title", dock, title)
minsize = dock.minsize if hasattr(dock, "minsize") else (60, 30)
dock.tk.call("wm", "minsize", dock, *minsize)
dock.tk.call("wm", "resizable", dock, False, False)
if TkUtil.windows():
dock.tk.call("wm", "attributes", dock, "-toolwindow", True)
if x is not None and y is not None:
self.xy_for_dock[dock] = (x, y)
x, y = self.xy_for_dock.get(dock, (None, None))
if x is not None and y is not None:
dock.tk.call("wm", "geometry", dock, "{:+}{:+}".format(x, y))
self.__remove_area(dock)
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def __init__(self, parent, char, font=("Courier", 14)):
super().__init__(parent,
bd=2,
relief=tk.RAISED,
bg="black",
fg="white",
font=font)
if not char.strip():
self["state"] = tk.DISABLED
self["relief"] = tk.FLAT
self["bd"] = 0
self.char = char
self.target = None
self.configure(text=self.char, command=self.on_press)
Key.all_keys.append(self)
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def __init__(self, parent):
super().__init__(parent)
var = tk.StringVar(self)
label = tk.Label(self, text="$ ", width=2, bg="grey26", fg="white", relief=tk.FLAT, bd=0)
self.entry = entry = tk.Entry(self,
width=78,
bg="grey26",
fg="white",
relief=tk.FLAT,
bd=0,
highlightthickness=0,
textvariable=var,
insertbackground="white")
label.grid(row=1, column=0)
entry.grid(row=1, column=1)
self.set = var.set
self.get = var.get
entry.bind("<Return>", self.on_enter)
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def __init__(self, parent, subindex, **kwargs):
# relief, bg, insertbackground hides its... Entryness.
super().__init__(parent,
text="",
relief=tk.FLAT,
bg=parent["bg"],
insertbackground=parent["bg"],
highlightcolor="red",
state="readonly",
selectbackground=parent["bg"], # so text doesn't have a highlight box
width=Order.longest_item,
**kwargs)
self._text = tk.StringVar(self)
self.configure(textvariable=self._text)
self.selected = False
self.subindex = subindex
self.index = None
self.bind("<Button-1>", self.on_press)
self.bind("<FocusIn>", self.on_focus_in)
self.bind("<FocusOut>", self.on_focus_out)
示例5: express
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def express():
global b1, b2, b3, b4, ee
if ee == 0:
ee = 1
b1 = tkinter.Button(root, command=bb1, image=p1,
relief=tkinter.FLAT, bd=0)
b2 = tkinter.Button(root, command=bb2, image=p2,
relief=tkinter.FLAT, bd=0)
b3 = tkinter.Button(root, command=bb3, image=p3,
relief=tkinter.FLAT, bd=0)
b4 = tkinter.Button(root, command=bb4, image=p4,
relief=tkinter.FLAT, bd=0)
b1.place(x=5, y=248)
b2.place(x=75, y=248)
b3.place(x=145, y=248)
b4.place(x=215, y=248)
else:
ee = 0
b1.destroy()
b2.destroy()
b3.destroy()
b4.destroy()
# 创建表情按钮
示例6: open_special_dlg
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def open_special_dlg(self):
'''Open a popup for selecting special characters
'''
self.special_dlg = Tk.Toplevel()
self.special_dlg.withdraw()
self.special_dlg.title('Select Special Characters')
self.special_dlg.resizable(width=False, height=False)
frame = Tk.Frame(self.special_dlg)
lb = Tk.Label(frame, text='Select Special Characters'.format(self.title))
lb.pack(fill='both', side='top')
box = Tk.Frame(frame)
self.chk_special = []
max_column_checks = 15
for v, val in enumerate(SPECIAL_CHARACTERS):
var = Tk.IntVar()
tmp = Tk.Checkbutton(box, text=val, relief=Tk.FLAT, variable=var)
self.chk_special.append(var)
tmp.grid(row=v % max_column_checks, column=v // max_column_checks,
sticky='W', padx=10)
box.pack(fill='both', side='top', padx=30, pady=20)
# Ok and Cancel buttons
btn_box = Tk.Frame(frame)
btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_special)
btn_cancel.pack(side='right', padx=10, pady=20)
btn_ok = Tk.Button(btn_box, text='Ok', command=self.on_ok_special_dlg)
btn_ok.pack(side='left', padx=10, pady=20)
btn_box.pack()
frame.pack(fill='both', padx=60, pady=10)
center_window(self.special_dlg, self.main.master)
self.special_dlg.focus_set()
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def __init__(self, master: Tk, initial_window_size: Tuple[int, int]):
self.master: Tk = master
self.frame: Frame = tk.Frame(self.master, relief=tk.FLAT)
self.frame.pack(fill=tk.BOTH, expand=tk.YES)
self.image_canvas: Canvas = Canvas(self.frame, highlightthickness=0)
self.image_canvas.pack(fill=tk.BOTH, expand=tk.YES)
self.master.geometry(
str(initial_window_size[0]) + "x" + str(initial_window_size[1]))
self.master.update()
self.controller = None
self.bind_events()
self.create_menu()
示例8: create_menu
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def create_menu(self):
self.menu: Menu = Menu(self.master, relief=tk.FLAT)
self.menu.add_command(label="Open", command=self.open_dialog)
self.menu.add_command(
label="Settings", command=self.create_settings_window)
self.menu.add_command(label="About", command=self.show_about_dialog)
self.menu.add_separator()
self.menu.add_command(label="Exit", command=self.master.quit)
self.master.config(menu=self.menu)
示例9: reset
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def reset(self):
self.item_info.reset()
self.addon1_info.reset()
self.addon2_info.reset()
self.ticket_no["relief"] = tk.FLAT
self["relief"] = tk.FLAT
示例10: update
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def update(self, item):
price = item.price + sum(item.options.get(opt, 0) for opt in item.selected_options)
if item.name:
self["relief"] = tk.RAISED
self["text"] = type(self).fmt(price / 100)
else:
self["relief"] = tk.FLAT
self["text"] = ""
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def __init__(self):
self.shown=False
self.zyngui=zynthian_gui_config.zyngui
# Main Frame
self.main_frame = tkinter.Frame(zynthian_gui_config.top,
width = zynthian_gui_config.display_width,
height = zynthian_gui_config.display_height,
bg = zynthian_gui_config.color_bg)
#Textarea
self.textarea = tkinter.Text(self.main_frame,
height = int(zynthian_gui_config.display_height/(zynthian_gui_config.font_size+8)),
font=(zynthian_gui_config.font_family,zynthian_gui_config.font_size,"normal"),
#wraplength=80,
#justify=tkinter.LEFT,
bd=0,
highlightthickness=0,
relief=tkinter.FLAT,
cursor="none",
bg=zynthian_gui_config.color_bg,
fg=zynthian_gui_config.color_tx)
self.textarea.bind("<Button-1>", self.cb_push)
#self.textarea.pack(fill="both", expand=True)
self.textarea.place(x=0,y=0)
self.textarea.tag_config("ERROR", foreground="#C00000")
self.textarea.tag_config("WARNING", foreground="#FF9000")
self.textarea.tag_config("SUCCESS", foreground="#009000")
self.textarea.tag_config("EMPHASIS", foreground="#0000C0")
示例12: open_sub_popup
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def open_sub_popup(self, type_):
'''Opens popup for defining the characters to substitute
type_: 'All', 'First', or 'Last'
'''
self.sub_popup = Tk.Toplevel()
self.sub_popup.withdraw()
self.sub_popup.title('Replace {}'.format(type_))
self.sub_popup.resizable(width=False, height=False)
frame = Tk.Frame(self.sub_popup)
lb = Tk.Label(frame, text='Select Substitution Checks'.format(self.title))
lb.pack(fill='both', side='top')
# Create a checkbox for each possible character substitution
box = Tk.Frame(frame)
self.chk_subs = []
max_column_checks = 15
for v in range(len(SUBSTITUTION_CHECKS)):
val = SUBSTITUTION_CHECKS[v]
var = Tk.IntVar()
tmp = Tk.Checkbutton(box, text=val, relief=Tk.FLAT, variable=var,
font=('Courier', '14'))
self.chk_subs.append(var)
# Split the checks into columns so the window isn't too tall
tmp.grid(row=v % max_column_checks, column=v // max_column_checks,
sticky='W', padx=10)
box.pack(fill='both', side='top', padx=30, pady=20)
box_type = Tk.Frame(frame)
self.sub_type = Tk.IntVar()
for i, val in enumerate(SPECIAL_TYPES):
tmp = Tk.Radiobutton(box_type, text=val, relief=Tk.FLAT, variable=self.sub_type, value=i)
tmp.pack(fill='both', side='left')
box_type.pack(fill='both', side='top', padx=30, pady=20)
btn_box = Tk.Frame(frame)
btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_sub_popup)
btn_cancel.pack(side='right', padx=10, pady=20)
btn_ok = Tk.Button(btn_box, text='Ok', command=partial(self.on_ok_sub_popup, type_))
btn_ok.pack(side='left', padx=10, pady=20)
btn_box.pack()
frame.pack(fill='both', padx=40, pady=10)
center_window(self.sub_popup, self.main.master)
self.sub_popup.focus_set()
示例13: open_date_dlg
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import FLAT [as 别名]
def open_date_dlg(self):
'''Open a popup for defining a range of dates
'''
self.custom_num_window = Tk.Toplevel()
self.custom_num_window.withdraw()
self.custom_num_window.title('{}: Date Selection'.format(self.title))
self.custom_num_window.resizable(width=False, height=False)
frame = Tk.Frame(self.custom_num_window)
lb = Tk.Label(frame, text='Select Dates to {}'.format(self.title))
lb.pack(fill='both', side='top')
# Boxes for inputting the start and endpoints
sp_box = Tk.Frame(frame)
lb1 = Tk.Label(sp_box, text='From')
lb1.pack(side='left', padx=5)
cur_year = datetime.date.today().year
self.sp_from = Tk.Spinbox(sp_box, width=12, from_=1950, to=cur_year)
self.sp_from.pack(side='left')
lb2 = Tk.Label(sp_box, text='To')
lb2.pack(side='left', padx=(50, 5))
var = Tk.IntVar()
var.set(str(cur_year))
self.sp_to = Tk.Spinbox(sp_box, width=12, from_=1950, to=cur_year, textvariable=var)
self.sp_to.pack(side='right')
sp_box.pack(fill='both', side='top', padx=30, pady=20)
# Choose how the dates are formatted (mmddyyyy etc.)
drop_down = Tk.OptionMenu(frame, self.date_format, *DATE_FORMATS)
drop_down.configure(width=max(map(len, DATE_FORMATS)) + 4)
self.date_format.set('mmddyy')
drop_down.pack(side='top')
self.date_zero_padding = Tk.IntVar()
checkbutton = Tk.Checkbutton(frame, text='Leading zero on single-digit d or m', relief=Tk.FLAT, variable=self.date_zero_padding)
checkbutton.pack()
# Ok and cancel buttons
btn_box = Tk.Frame(frame)
btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_custom_num_window)
btn_cancel.pack(side='right', padx=10, pady=20)
btn_ok = Tk.Button(btn_box, text='Ok', command=self.on_ok_date_window)
btn_ok.pack(side='left', padx=10, pady=20)
btn_box.pack()
frame.pack(fill='both', padx=10, pady=10)
center_window(self.custom_num_window, self.main.master)
self.custom_num_window.focus_set()