本文整理汇总了Python中tkinter.ttk.Frame.columnconfigure方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.columnconfigure方法的具体用法?Python Frame.columnconfigure怎么用?Python Frame.columnconfigure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Frame
的用法示例。
在下文中一共展示了Frame.columnconfigure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def __init__(self, parent, title, imageFile, body):
super(DialogAbout, self).__init__(parent)
self.parent = parent
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.transient(self.parent)
self.title(title)
frame = Frame(self)
image = PhotoImage(file=imageFile)
aboutImage = Label(frame, image=image)
aboutBody = Label(frame, text=body, wraplength=500)
okButton = Button(frame, text=_("OK"), command=self.ok)
okButton.focus_set()
aboutImage.grid(row=0, column=0, sticky=NW, pady=20, padx=16)
aboutBody.grid(row=0, column=1, columnspan=2, sticky=EW, pady=3, padx=0)
okButton.grid(row=1, column=2, sticky=EW, pady=3)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(1, weight=1)
window = self.winfo_toplevel()
window.columnconfigure(0, weight=1)
self.geometry("+{0}+{1}".format(dialogX+200,dialogY+200))
self.bind("<Alt-u>", lambda *ignore: okButton.focus_set())
self.bind("<Return>", self.ok)
self.bind("<Escape>", self.close)
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
示例2: create_widgets
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def create_widgets(self):
''' Creates appropriate widgets on this frame.
'''
self.columnconfigure(0, weight=1)
self.rowconfigure(3, weight=1)
frame_for_save_btn = Frame(self)
frame_for_save_btn.columnconfigure(1, weight=1)
self.status_lbl = Label(frame_for_save_btn, text='')
self.status_lbl.grid(row=0, column=1, sticky=N+W)
save_solution_btn = Button(frame_for_save_btn, text='Save solution',
command=self.on_save_solution)
save_solution_btn.grid(row=1, column=0, sticky=W+N, padx=5, pady=5)
self.progress_bar = Progressbar(frame_for_save_btn,
mode='determinate', maximum=100)
self.progress_bar.grid(row=1, column=1, sticky=W+E, padx=10, pady=5)
frame_for_save_btn.grid(sticky=W+N+E+S, padx=5, pady=5)
frame_for_btns = Frame(self)
self._create_file_format_btn('*.xlsx', 1, frame_for_btns, 0)
self._create_file_format_btn('*.xls', 2, frame_for_btns, 1)
self._create_file_format_btn('*.csv', 3, frame_for_btns, 2)
self.solution_format_var.set(1)
frame_for_btns.grid(row=1, column=0, sticky=W+N+E+S, padx=5, pady=5)
self.data_from_file_lbl = Label(self, text=TEXT_FOR_FILE_LBL, anchor=W,
justify=LEFT,
wraplength=MAX_FILE_PARAMS_LBL_LENGTH)
self.data_from_file_lbl.grid(row=2, column=0, padx=5, pady=5,
sticky=W+N)
self.solution_tab = SolutionFrameWithText(self)
self.solution_tab.grid(row=3, column=0, sticky=W+E+S+N, padx=5, pady=5)
示例3: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def __init__(self, mainWin, options):
self.mainWin = mainWin
parent = mainWin.parent
super(DialogNewFactItemOptions, self).__init__(parent)
self.parent = parent
self.options = options
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.accepted = False
self.transient(self.parent)
self.title(_("New Fact Item Options"))
frame = Frame(self)
label(frame, 1, 1, "Entity scheme:")
self.cellEntityIdentScheme = gridCell(frame, 2, 1, getattr(options,"entityIdentScheme",""), width=50)
ToolTip(self.cellEntityIdentScheme, text=_("Enter the scheme for the context entity identifier"), wraplength=240)
label(frame, 1, 2, "Entity identifier:")
self.cellEntityIdentValue = gridCell(frame, 2, 2, getattr(options,"entityIdentValue",""))
ToolTip(self.cellEntityIdentValue, text=_("Enter the entity identifier value (e.g., stock ticker)"), wraplength=240)
label(frame, 1, 3, "Start date:")
startDate = getattr(options,"startDate",None)
self.cellStartDate = gridCell(frame, 2, 3, XmlUtil.dateunionValue(startDate) if startDate else "")
ToolTip(self.cellStartDate, text=_("Enter the start date for the report period (e.g., 2010-01-01)"), wraplength=240)
label(frame, 1, 4, "End date:")
endDate = getattr(options,"endDate",None)
self.cellEndDate = gridCell(frame, 2, 4, XmlUtil.dateunionValue(endDate, subtractOneDay=True) if endDate else "")
ToolTip(self.cellEndDate, text=_("Enter the end date for the report period (e.g., 2010-12-31)"), wraplength=240)
label(frame, 1, 5, "Monetary unit:")
self.cellMonetaryUnit = gridCombobox(frame, 2, 5, getattr(options,"monetaryUnit",""), values=monetaryUnits)
ToolTip(self.cellMonetaryUnit, text=_("Select a monetary unit (e.g., EUR)"), wraplength=240)
label(frame, 1, 6, "Monetary decimals:")
self.cellMonetaryDecimals = gridCell(frame, 2, 6, getattr(options,"monetaryDecimals","2"))
ToolTip(self.cellMonetaryDecimals, text=_("Enter decimals for monetary items"), wraplength=240)
label(frame, 1, 7, "Non-monetary decimals:")
self.cellNonMonetaryDecimals = gridCell(frame, 2, 7, getattr(options,"nonMonetaryDecimals","0"))
ToolTip(self.cellNonMonetaryDecimals, text=_("Enter decimals for non-monetary items (e.g., stock shares)"), wraplength=240)
cancelButton = Button(frame, text=_("Cancel"), width=8, command=self.close)
ToolTip(cancelButton, text=_("Cancel operation, discarding changes and entries"))
okButton = Button(frame, text=_("OK"), width=8, command=self.ok)
ToolTip(okButton, text=_("Accept the options as entered above"))
cancelButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=3)
okButton.grid(row=8, column=1, columnspan=3, sticky=E, pady=3, padx=86)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(2, weight=1)
window = self.winfo_toplevel()
window.columnconfigure(0, weight=1)
self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
#self.bind("<Return>", self.ok)
#self.bind("<Escape>", self.close)
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
示例4: FrontEnd
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class FrontEnd(Frame):
def __init__(self, master, version):
Frame.__init__(self, master)
master.title(version[:-5])
# MAKE IT LOOK GOOD
style = Style()
style.configure("atitle.TLabel", font="tkDefaultFont 12 bold italic")
# CREATE AND SET VARIABLES
self.version = version
self.description = None
self.logo = None
self.status_lbl = StringVar() # TO HOLD STATUS VARIABLE IN STATUSBAR
# CREATE ROOT MENUBAR
menubar = Menu(self.master)
self.master["menu"] = menubar
self.master.option_add("*tearOff", False)
# CREATE FILE MENU
self.menu_file = Menu(menubar, name="file")
self.menu_file.add_separator()
self.menu_file.add_command(label="Exit", accelerator="Alt-F4", command=self.master.destroy)
menubar.add_cascade(menu=self.menu_file, label="File", underline=0)
# CREATE HELP MENU
menu_help = Menu(menubar, name="help")
menu_help.add_command(label="About", command=self.show_about)
menubar.add_cascade(menu=menu_help, label="Help", underline=0)
# CREATE BUTTON BAR
self.button_bar = Frame(self.master, relief="groove", padding="0 1 0 2")
self.button_bar.grid(sticky="ew")
# SETUP PRIMARY FRAME FOR WIDGETS
self.frame = Frame(self.master, padding="25")
self.frame.grid(sticky="nsew")
# CREATE STATUS BAR
Separator(self.master).grid(row=8, sticky="ew")
self.status_bar = Frame(self.master, padding="8 0 0 1")
self.status_bar.grid(row=9, sticky="ews")
Label(self.status_bar, textvariable=self.status_lbl).grid(row=0, column=0, padx="0 7")
Label(self.status_bar, text=self.version[-5:]).grid(row=0, column=8)
Sizegrip(self.status_bar).grid(row=0, column=9, sticky="e")
# CONFIGURE AUTO-RESIZING
self.master.columnconfigure(0, weight=1)
self.master.rowconfigure(1, weight=1)
self.frame.columnconfigure(0, weight=1)
# self.frame.rowconfigure(0, weight=1)
self.status_bar.columnconfigure(1, weight=1)
def show_about(self):
about = About(self.master, "About {}".format(self.version[:-5]), self.logo)
Label(about.frame, text=self.version, style="atitle.TLabel").grid(sticky="w")
Label(about.frame, text="Developer: Joel W. Dafoe").grid(pady="6", sticky="w")
link = Link(about.frame, text="http://cyberdatx.com", foreground="blue", cursor="hand2")
link.grid(sticky="w")
link.bind("<Button-1>", lambda e: webbrowser.open("http://cyberdatx.com"))
Label(about.frame, text=self.description, wraplength=292).grid(columnspan=2, pady=6, sticky=W)
示例5: ListDialog
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class ListDialog(object):
def __init__ (self, master, items, message, accept_func):
self.accept_func = accept_func
self.top = Toplevel(master)
self.top.transient(master)
self.top.rowconfigure(0, weight=1)
self.top.rowconfigure(1, weight=3)
self.top.rowconfigure(2, weight=0)
self.top.columnconfigure(0, weight=1)
self.top.columnconfigure(1, weight=1)
self.top.resizable(width=True, height=True)
self.frame = Frame(self.top)
self.frame.rowconfigure(0, weight=1)
self.frame.rowconfigure(1, weight=0)
self.frame.columnconfigure(0, weight=1)
self.frame.columnconfigure(1, weight=0)
self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2)
self.canvas = Canvas(self.frame)
self.canvas.create_text(0, 0, text=message, anchor=NW)
self.canvas.grid(row=0, column=0, sticky=(N, W, S, E))
self.vscroll = Scrollbar(self.frame, command=self.canvas.yview)
self.vscroll.grid(row=0, column=1, sticky=(N, S))
self.canvas['yscrollcommand'] = self.vscroll.set
self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL)
self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2)
self.canvas['xscrollcommand'] = self.hscroll.set
self.canvas['scrollregion'] = self.canvas.bbox('all')
self.canvas.bind('<Button-4>', self.scroll)
self.canvas.bind('<Button-5>', self.scroll)
self.canvas.bind('<MouseWheel>', self.scroll)
self.view = NameView(self.top, sorted(items))
self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S))
self.delbutton = Button(self.top, text='Ok', command=self.accept )
self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel)
self.delbutton.grid(row=2, column=0)
self.cancelbutton.grid(row=2, column=1)
self.view.widget.focus_set()
def accept(self):
self.accept_func(self.view.selection())
self.top.destroy()
def cancel(self):
self.result = None
self.top.destroy()
def scroll(self, event):
if event.num == 4 or event.delta > 0:
self.canvas.yview(SCROLL, -1, UNITS)
elif event.num == 5 or event.delta < 0:
self.canvas.yview(SCROLL, 1, UNITS)
示例6: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def __init__(self, parent, url=None, buttonSEC=False, buttonRSS=False):
super(DialogURL, self).__init__(parent)
self.parent = parent
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.accepted = False
self.url = None
self.transient(self.parent)
self.title("Enter URL")
self.urlVar = StringVar()
self.urlVar.set(url if url is not None else "http://")
frame = Frame(self)
urlLabel = Label(frame, text=_("URL:"), underline=0)
urlEntry = Entry(frame, textvariable=self.urlVar, width=60)
urlEntry.focus_set()
okButton = Button(frame, text=_("OK"), command=self.ok)
cancelButton = Button(frame, text=_("Cancel"), command=self.close)
if buttonSEC:
usSecButton = Button(frame, text=_("SEC search"), command=self.usSec)
usSecButton.grid(row=1, column=1, sticky=W, pady=3)
ToolTip(usSecButton, text=_("Opens US SEC Edgar Company Search (in web browser)\n\n"
"(1) Find the company in web browser,\n"
"(2) Click 'documents' button for desired filing,\n"
"(3) Find 'data files' panel, instance document row, 'document' column,\n"
"(4) On instance document file name, right-click browser menu: 'copy shortcut',\n"
"(5) Come back to this dialog window,\n"
"(6) Ctrl-v (paste) shortcut into above URL text box,\n"
"(7) Click ok button to load instance document"),
wraplength=480)
if buttonRSS:
rssButton = Button(frame, text=_("SEC RSS"), command=self.rssFeed)
rssButton.grid(row=1, column=1, pady=3)
ToolTip(rssButton, text=_("Opens current US SEC Edgar RSS feed"),
wraplength=480)
urlLabel.grid(row=0, column=0, sticky=W, pady=3, padx=3)
urlEntry.grid(row=0, column=1, columnspan=3, sticky=EW, pady=3, padx=3)
okButton.grid(row=1, column=2, sticky=E, pady=3)
ToolTip(okButton, text=_("Opens above URL from web cache, downloading to cache if necessary"), wraplength=240)
cancelButton.grid(row=1, column=3, sticky=EW, pady=3, padx=3)
ToolTip(cancelButton, text=_("Cancel operation"))
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(1, weight=1)
window = self.winfo_toplevel()
window.columnconfigure(0, weight=1)
self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
self.bind("<Alt-u>", lambda *ignore: urlEntry.focus_set())
self.bind("<Return>", self.ok)
self.bind("<Escape>", self.close)
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
示例7: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def __init__(self, master:Notebook, text, *args, **kw):
super(TextPage, self).__init__(master, *args, **kw)
f = Frame(master)
self.grid(in_=f, row=0, column=0, sticky=NSEW)
self.lift(f)
sb = Scrollbar(f, orient='vertical', command=self.yview)
sb.grid(row=0, column=1, sticky=NS)
self.configure(yscrollcommand=sb.set)
f.columnconfigure(0, weight=1)
f.rowconfigure(0, weight=1)
master.add(f, text=text)
示例8: create_status_bar
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def create_status_bar(self, master):
statbar = Frame(master, padding = '3 3 3 3')
statbar.grid(column=0, row=2, sticky=(EW, S))
Label(statbar, text='RDFS File:', padding='0 3 0 3').grid(row=0, column=0, sticky=SE)
rdfsFileNameLbl = Label(statbar, textvariable=self.rdfsFileName,
background='#bbb', relief=SUNKEN, padding='3 3 3 3')
rdfsFileNameLbl.grid(column=1, row=0, sticky=(EW))
Label(statbar, text='Template file:', padding='0 3 0 3').grid(row=1, column=0, sticky=SE)
templateFileNameLbl = Label(statbar, textvariable=self.templateFileName,
background='#bbb', relief=SUNKEN, padding='3 3 3 3')
templateFileNameLbl.grid(column=1, row=1, sticky=(EW))
statbar.columnconfigure(1, weight=1)
for child in statbar.winfo_children():
child.grid_configure(padx=3, pady=3)
示例9: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class Scratchpad:
def __init__(self):
self.window = Tk()
self.window.title("Onager Scratchpad")
self.create_frame()
self.create_editing_window()
self.window.bind('<F7>', self.save_file)
self.window.bind('<F5>', self.open_file)
def create_frame(self):
frame_style = Style()
frame_style.theme_use('alt')
frame_style.configure("TFrame",
relief='raised')
self.frame = Frame(self.window, style="frame_style.TFrame")
self.frame.rowconfigure(1)
self.frame.columnconfigure(1)
self.frame.grid(row=0, column=0)
def create_editing_window(self):
self.editing_window = ScrolledText(self.frame)
self.editing_window.configure(fg='gold',
bg='blue',
font='serif 12',
padx='15',
pady='15',
wrap='word',
borderwidth='10',
relief='sunken',
tabs='48',
insertbackground='cyan')
self.editing_window.grid(row=0, column=0)
def save_file(self, event=None):
name = asksaveasfilename()
outfile = open(name, 'w')
contents = self.editing_window.get(0.0, END)
outfile.write(contents)
outfile.close()
def open_file(self, event=None):
name = askopenfilename()
infile = open(name, 'r')
contents = infile.read()
self.editing_window.insert(INSERT, contents)
infile.close()
示例10: create_rdfs_frame
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def create_rdfs_frame(self, master:Notebook):
rdfsframe = Frame(master, padding = '3 3 3 3', width=600, height=400)
Label(rdfsframe, text='RDFS Name:', padding='3 3 3 3').grid(row=0, column=0, padx=3, pady=3)
rdfsNameLbl = Label(rdfsframe, textvariable=self.rdfsName,
background='#bbb', relief=SUNKEN, padding='3 0 3 3')
rdfsNameLbl.grid(row=0, column=1, columnspan=3, sticky=EW, padx=3, pady=6)
self.classtree.heading(column='#0', text='ClassTree')
ysb = Scrollbar(rdfsframe, orient='vertical', command=self.classtree.yview)
xsb = Scrollbar(rdfsframe, orient='horizontal', command=self.classtree.xview)
self.classtree.configure(yscrollcommand=ysb.set)
self.classtree.configure(xscrollcommand=xsb.set)
self.classtree.bind('<<TreeviewSelect>>', self.update_classinfo)
self.classtree.grid(row=1, column=0, columnspan=2, in_=rdfsframe, sticky=NSEW)
self.classtree.lift(rdfsframe)
self.classtree.tag_configure('include', foreground='black')
self.classtree.tag_configure('notinclude', foreground='gray')
ysb.grid(row=1, column=2, sticky=(NS))
xsb.grid(row=2, column=0, columnspan=2, sticky=(EW))
classinfoframe = Frame(rdfsframe, width=300, height=400)
classinfoframe.grid(row=1, column=3, padx=3, pady=3, sticky=(NSEW))
Label(classinfoframe, text='Class Name:',
font='bold', padding='3 3 3 3').grid(row=1, column=0, sticky=NW)
classNameLbl = Label(classinfoframe, textvariable=self.className,
background='#bbb', relief=SUNKEN, padding='3 3 3 3',
font='bold', width=25)
classNameLbl.grid(row=1, column=1, sticky=EW)
Label(classinfoframe, text='Description:',
font='bold', padding='3 3 3 3').grid(row=2, column=0, sticky=NW)
self.classDescrTxt.grid(row=2, column=1, in_=classinfoframe, sticky=EW)
self.classDescrTxt.lift(classinfoframe)
include_chk = Checkbutton(classinfoframe,
text='include this class',
variable=self.includeclass,
command=self.include_class)
include_chk.grid(row=3, column=1, sticky=E)
Label(classinfoframe, text='Properties:',
font='bold', padding='3 3 3 3').grid(row=5, column=0, sticky=NW)
self.propertiesframe.grid(in_ = classinfoframe, row=5, column=1, sticky=(N+E+S+W))
self.propertiesframe.lift(classinfoframe)
classinfoframe.rowconfigure(5, weight=1)
classinfoframe.columnconfigure(1, weight=1)
rdfsframe.columnconfigure(1, weight=1)
rdfsframe.columnconfigure(3, weight=3)
rdfsframe.rowconfigure(1, weight=1)
master.add(rdfsframe, text='RDFS')
示例11: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class ScrolledCanvas:
def __init__(self, master, **opts):
if 'yscrollincrement' not in opts:
opts['yscrollincrement'] = 17
self.master = master
self.frame = Frame(master)
self.frame.rowconfigure(0, weight=1)
self.frame.columnconfigure(0, weight=1)
self.canvas = Canvas(self.frame, **opts)
self.canvas.grid(row=0, column=0, sticky="nsew")
self.vbar = Scrollbar(self.frame, name="vbar")
self.vbar.grid(row=0, column=1, sticky="nse")
self.hbar = Scrollbar(self.frame, name="hbar", orient="horizontal")
self.hbar.grid(row=1, column=0, sticky="ews")
self.canvas['yscrollcommand'] = self.vbar.set
self.vbar['command'] = self.canvas.yview
self.canvas['xscrollcommand'] = self.hbar.set
self.hbar['command'] = self.canvas.xview
self.canvas.bind("<Key-Prior>", self.page_up)
self.canvas.bind("<Key-Next>", self.page_down)
self.canvas.bind("<Key-Up>", self.unit_up)
self.canvas.bind("<Key-Down>", self.unit_down)
#if isinstance(master, Toplevel) or isinstance(master, Tk):
self.canvas.bind("<Alt-Key-2>", self.zoom_height)
self.canvas.focus_set()
def page_up(self, event):
self.canvas.yview_scroll(-1, "page")
return "break"
def page_down(self, event):
self.canvas.yview_scroll(1, "page")
return "break"
def unit_up(self, event):
self.canvas.yview_scroll(-1, "unit")
return "break"
def unit_down(self, event):
self.canvas.yview_scroll(1, "unit")
return "break"
def zoom_height(self, event):
zoomheight.zoom_height(self.master)
return "break"
示例12: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
def __init__(self, tester):
self.tester = tester
self.mainWin = tester.cntlr
parent = self.mainWin.parent
super(DialogTransformTester, self).__init__(parent)
self.parent = parent
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.selectedGroup = None
self.transient(self.parent)
self.title(_("Transformation Tester"))
frame = Frame(self)
# load grid
trRegLabel = label(frame, 0, 0, _("Registry:"))
trReg = self.tester.trRegs[-1] # default is latest
self.trRegName = gridCombobox(frame, 1, 0,
value=trReg,
values=self.tester.trRegs,
comboboxselected=self.dialogTrRegComboBoxSelected)
trRegToolTipMessage = _("Select Transformation Registry")
ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)
trNameLabel = label(frame, 0, 1, _("Transform:"))
self.trNameName = gridCombobox(frame, 1, 1,
value="",
values=self.tester.getTrNames(trReg),
comboboxselected=self.dialogTrNameComboBoxSelected)
trRegToolTipMessage = _("Select or enter transform")
ToolTip(self.trRegName, text=trRegToolTipMessage, wraplength=360)
ToolTip(trRegLabel, text=trRegToolTipMessage, wraplength=360)
sourceLabel = label(frame, 0, 2, _("Source text:"))
ToolTip(sourceLabel, text=_("Enter the source text which is to be transformed. "), wraplength=240)
self.sourceVar = StringVar()
self.sourceVar.set("")
sourceEntry = Entry(frame, textvariable=self.sourceVar, width=50)
sourceLabel.grid(row=2, column=0, sticky=W)
sourceEntry.grid(row=2, column=1, sticky=EW, pady=3, padx=3)
resultLabel = label(frame, 1, 3, _("Result:"))
ToolTip(sourceLabel, text=_("Transformation result. "), wraplength=240)
self.resultVar = StringVar()
self.resultVar.set("")
resultEntry = Entry(frame, textvariable=self.resultVar, width=50)
resultLabel.grid(row=3, column=0, sticky=W)
resultEntry.grid(row=3, column=1, sticky=EW, pady=3, padx=3)
self.mainWin.showStatus(None)
btnPad = 2 if self.mainWin.isMSW else 0 # buttons too narrow on windows
okButton = Button(frame, text=_("Transform"), width=8 + btnPad, command=self.dialogOk)
cancelButton = Button(frame, text=_("Done"), width=4 + btnPad, command=self.dialogClose)
cancelButton.grid(row=4, column=0, sticky=E, columnspan=2, pady=3, padx=3)
okButton.grid(row=4, column=0, sticky=E, columnspan=2, pady=3, padx=64)
ToolTip(okButton, text=_("Transform the source entered. "), wraplength=240)
ToolTip(cancelButton, text=_("Close this dialog. "), wraplength=240)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(1, weight=3)
frame.columnconfigure(2, weight=1)
window = self.winfo_toplevel()
window.columnconfigure(0, weight=1)
self.geometry("+{0}+{1}".format(dialogX+150,dialogY+100))
#self.bind("<Return>", self.ok)
#self.bind("<Escape>", self.close)
self.protocol("WM_DELETE_WINDOW", self.dialogClose)
self.grab_set()
self.wait_window(self)
示例13: __init__
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
#.........这里部分代码省略.........
self.objsList = [] # next may be tried before anything is found
frame = Frame(self)
# load grid
findLabel = gridHdr(frame, 1, 0, "Find:", anchor="w")
findLabel.grid(padx=8)
self.cbExpr = gridCombobox(frame, 1, 1, values=options["priorExpressions"])
self.cbExpr.grid(columnspan=3, padx=8)
ToolTip(self.cbExpr, text=_("Enter expression to find, or select from combo box drop down history list."), wraplength=240)
y = 2
# checkbox entries
label(frame, 1, y, "Direction:")
label(frame, 1, y + 3, "Match:")
scopeLabel = label(frame, 2, y, "Scope:")
ToolTip(scopeLabel, text=_("Scope for an XBRL document (instance or DTS). "
"For an RSS Feed, all properties are matched. "), wraplength=240)
rbUp = radiobutton(frame, 1, y+1, "Up", "up", "direction")
ToolTip(rbUp, text=_("Find/Next up (on screen) from last to first match."), wraplength=240)
rbDn = radiobutton(frame, 1, y+2, "Down", "down", "direction", rbUp.valueVar)
ToolTip(rbDn, text=_("Find/Next down (on screen) from first to last match."), wraplength=240)
rbText = radiobutton(frame, 1, y+4, "Text (ignore case)", "text", "exprType")
ToolTip(rbText, text=_("Expression is a set of characters to match, ignoring case. "
"The match may occur anywhere within the scope. "), wraplength=360)
rbRegex = radiobutton(frame, 1, y+5, "Regular expression", "regex", "exprType", rbText.valueVar)
ToolTip(rbRegex, text=_('A regular expression to match, anywhere in the scope, ignoring case. '
'For example, "cash" would match cash anywhere in a string (like cash on hand), '
'whereas "^cash$" would match a full string to only contain cash. '
'Use regular expression metacharacters, e.g., "." for any single character, '
'".*" for any number of wild characters, .{3} for exactly 3 wild characters. '), wraplength=360)
rbXPath = radiobutton(frame, 1, y+6, "XPath 2 expression", "xpath", "exprType", rbText.valueVar)
ToolTip(rbXPath, text=_('An XPath 2 expression, where the context element, ".", is a candidate concept QName, if any concept scope is checked, '
'and a candidate fact item, if any fact scope is checked. The XPath 2 functions do not need an "fn:" prefix (but it is defined). '
'The XBRL Functions Registry functions do require an "xfi:" prefix. Constructors require an "xs:" prefix. '
'The expression is considered "matched" for the candidate concept QNames or fact items where the effective boolean value of the expression is "true()". '), wraplength=360)
self.optionControls = (
rbUp,
rbDn,
rbText,
rbRegex,
rbXPath,
#checkbox(frame, 2, y + 1, "All", "all"),
checkbox(frame, 2, y + 1, "Concept label", "conceptLabel"),
checkbox(frame, 2, y + 2, " name", "conceptName"),
checkbox(frame, 2, y + 3, " type", "conceptType"),
checkbox(frame, 2, y + 4, " subs group", "conceptSubs"),
checkbox(frame, 2, y + 5, " period type", "conceptPer"),
checkbox(frame, 2, y + 6, " balance", "conceptBal"),
checkbox(frame, 3, y + 1, "Fact label", "factLabel"),
checkbox(frame, 3, y + 2, " name", "factName"),
checkbox(frame, 3, y + 3, " value", "factValue"),
checkbox(frame, 3, y + 4, " context", "factCntx"),
checkbox(frame, 3, y + 5, " unit", "factUnit"),
checkbox(frame, 3, y + 6, "Messages", "messagesLog"),
# Note: if adding to this list keep Finder.FindOptions in sync
)
y += 7
resultLabel = gridHdr(frame, 1, y, "Result:", anchor="w")
resultLabel.grid(padx=8)
self.resultText = gridCell(frame, 1, y + 1)
self.resultText.grid(columnspan=3, padx=8)
self.resultText.config(state="readonly")
y += 2
mainWin.showStatus(None)
buttonFrame = Frame(frame)
buttonFrame.grid(columnspan=4, sticky=E, padx=8)
findButton = Button(buttonFrame, text=_("Find"), width=12, command=self.find)
ToolTip(findButton, text=_('Compile (if regular expression or XPath 2), and find first match (if down direction) or last match (if up direction). '), wraplength=240)
nextButton = Button(buttonFrame, text=_("Next"), width=12, command=self.next)
ToolTip(nextButton, text=_('Advance to the next matched object (in selected direction). '), wraplength=240)
closeButton = Button(buttonFrame, text=_("Close"), width=12, command=self.close)
ToolTip(closeButton, text=_('Close the find dialog. '), wraplength=240)
findButton.grid(row=1, column=1, pady=3)
nextButton.grid(row=1, column=2, pady=3)
closeButton.grid(row=1, column=3, padx=3)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(1, weight=1)
frame.columnconfigure(2, weight=1)
frame.columnconfigure(3, weight=1)
window = self.winfo_toplevel()
window.columnconfigure(0, weight=1)
if self.options["geometry"]:
self.geometry(self.options["geometry"])
else:
self.geometry("+{0}+{1}".format(dialogX+50,dialogY+100))
#self.bind("<Return>", self.ok)
#self.bind("<Escape>", self.close)
self.protocol("WM_DELETE_WINDOW", self.close)
# make this dialog non-modal
self.focus_set()
示例14: qbtConvertor
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class qbtConvertor(Tk):
""" GUI Application for migration from uTorrent to qBittorrent """
def __init__(self):
Tk.__init__(self)
self.title("uT to qBt convertor")
#main frame
self.main_frame = Frame(self, padding="3 3 12 12")
self.main_frame.grid(column=0, row=0, sticky=(N, W, E, S))
self.main_frame.columnconfigure(0, weight=1)
self.main_frame.rowconfigure(0, weight=1)
#uT part
self.ut_data = StringVar()
self.ut_label = Label(self.main_frame, text="uT data")
self.ut_label.grid(column=0, row=1, sticky=(W))
self.ut_entry = Entry(self.main_frame, width=100, textvariable=self.ut_data)
self.ut_entry.grid(column=1, row=1, sticky=(W))
self.ut_button = Button(self.main_frame, text="Browse", command=self.load_file)
self.ut_button.grid(column=2, row=1)
#qBt part
self.qbt_folder = StringVar()
self.qbt_label = Label(self.main_frame, text="qBt folder")
self.qbt_label.grid(column=0, row=4, sticky=(W))
self.qbt_entry = Entry(self.main_frame, width=100, textvariable=self.qbt_folder)
self.qbt_entry.grid(column=1, row=4, sticky=(W))
self.qbt_button = Button(self.main_frame, text="Browse", command=self.open_dir)
self.qbt_button.grid(column=2, row=4, sticky=(W, E))
#convertor
self.convertor_button = Button(self.main_frame, text="Convert", command=self.convert,
width=50)
self.convertor_button.grid(column=1, columnspan=2, row=5)
self.progress_bar = Progressbar(self.main_frame, orient=HORIZONTAL, length=300, mode="indeterminate")
self.progress_bar.grid(column=1, columnspan=3, row=6)
#set padding for each element
for child in self.main_frame.winfo_children():
child.grid_configure(padx=5, pady=5)
def convert(self):
message = messagebox
if not self.qbt_folder.get() or not self.ut_data.get():
message.showerror("ERROR", "Specify paths!")
return
self.progress_bar.start()
convertor(self.ut_data.get(), self.qbt_folder.get())
self.progress_bar.stop()
def load_file(self):
file_name = filedialog.askopenfilename(filetypes=(("UT resume file", "*.dat"),
("All", "*")))
if file_name:
self.ut_data.set(file_name)
def open_dir(self):
dir_name = filedialog.askdirectory()
if dir_name:
self.qbt_folder.set(dir_name)
示例15: Sudoku
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import columnconfigure [as 别名]
class Sudoku(Tk):
def __init__(self, file=None):
Tk.__init__(self, className="Sudoku-Tk")
self.title("Sudoku-Tk")
self.resizable(0, 0)
self.protocol("WM_DELETE_WINDOW", self.quitter)
cst.set_icon(self)
self.columnconfigure(3, weight=1)
# --- style
bg = '#dddddd'
activebg = '#efefef'
pressedbg = '#c1c1c1'
lightcolor = '#ededed'
darkcolor = '#cfcdc8'
bordercolor = '#888888'
focusbordercolor = '#5E5E5E'
disabledfg = '#999999'
disabledbg = bg
button_style_config = {'bordercolor': bordercolor,
'background': bg,
'lightcolor': lightcolor,
'darkcolor': darkcolor}
button_style_map = {'background': [('active', activebg),
('disabled', disabledbg),
('pressed', pressedbg)],
'lightcolor': [('pressed', darkcolor)],
'darkcolor': [('pressed', lightcolor)],
'bordercolor': [('focus', focusbordercolor)],
'foreground': [('disabled', disabledfg)]}
style = Style(self)
style.theme_use(cst.STYLE)
style.configure('TFrame', background=bg)
style.configure('TLabel', background=bg)
style.configure('TScrollbar', gripcount=0, troughcolor=pressedbg,
**button_style_config)
style.map('TScrollbar', **button_style_map)
style.configure('TButton', **button_style_config)
style.map('TButton', **button_style_map)
style.configure('TCheckutton', **button_style_config)
style.map('TCheckutton', **button_style_map)
self.option_add('*Toplevel.background', bg)
self.option_add('*Menu.background', bg)
self.option_add('*Menu.activeBackground', activebg)
self.option_add('*Menu.activeForeground', "black")
self.configure(bg=bg)
style.configure("bg.TFrame", background="grey")
style.configure("case.TFrame", background="white")
style.configure("case.TLabel", background="white", foreground="black")
style.configure("case_init.TFrame", background="lightgrey")
style.configure("case_init.TLabel", background="lightgrey", foreground="black")
style.configure("erreur.TFrame", background="white")
style.configure("erreur.TLabel", background="white", foreground="red")
style.configure("solution.TFrame", background="white")
style.configure("solution.TLabel", background="white", foreground="blue")
style.configure("pause.TLabel", foreground="grey", background='white')
# --- images
self.im_erreur = open_image(cst.ERREUR)
self.im_pause = open_image(cst.PAUSE)
self.im_restart = open_image(cst.RESTART)
self.im_play = open_image(cst.PLAY)
self.im_info = open_image(cst.INFO)
self.im_undo = open_image(cst.UNDO)
self.im_redo = open_image(cst.REDO)
self.im_question = open_image(cst.QUESTION)
# --- timer
self.chrono = [0, 0]
self.tps = Label(self, text=" %02i:%02i" % tuple(self.chrono),
font="Arial 16")
self.debut = False # la partie a-t-elle commencée ?
self.chrono_on = False # le chrono est-il en marche ?
# --- buttons
self.b_pause = Button(self, state="disabled", image=self.im_pause,
command=self.play_pause)
self.b_restart = Button(self, state="disabled", image=self.im_restart,
command=self.recommence)
self.b_undo = Button(self, image=self.im_undo, command=self.undo)
self.b_redo = Button(self, image=self.im_redo, command=self.redo)
# --- tooltips
self.tooltip_wrapper = TooltipWrapper(self)
self.tooltip_wrapper.add_tooltip(self.b_pause, _("Pause game"))
self.tooltip_wrapper.add_tooltip(self.b_restart, _("Restart game"))
self.tooltip_wrapper.add_tooltip(self.b_undo, _("Undo"))
self.tooltip_wrapper.add_tooltip(self.b_redo, _("Redo"))
# --- numbers
frame_nb = Frame(self, style='bg.TFrame', width=36)
self.progression = []
for i in range(1, 10):
self.progression.append(Progression(frame_nb, i))
self.progression[-1].pack(padx=1, pady=1)
#.........这里部分代码省略.........