本文整理汇总了Python中tkinter.ttk.Treeview.set方法的典型用法代码示例。如果您正苦于以下问题:Python Treeview.set方法的具体用法?Python Treeview.set怎么用?Python Treeview.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Treeview
的用法示例。
在下文中一共展示了Treeview.set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DialogPluginManager
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class DialogPluginManager(Toplevel):
def __init__(self, mainWin, modulesWithNewerFileDates):
super(DialogPluginManager, self).__init__(mainWin.parent)
self.ENABLE = _("Enable")
self.DISABLE = _("Disable")
self.parent = mainWin.parent
self.cntlr = mainWin
# copy plugins for temporary display
self.pluginConfig = PluginManager.pluginConfig
self.pluginConfigChanged = False
self.uiClassMethodsChanged = False
self.modelClassesChanged = False
self.disclosureSystemTypesChanged = False
self.hostSystemFeaturesChanged = False
self.modulesWithNewerFileDates = modulesWithNewerFileDates
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", self.parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.title(_("Plug-in Manager"))
frame = Frame(self)
# left button frame
buttonFrame = Frame(frame, width=40)
buttonFrame.columnconfigure(0, weight=1)
addLabel = Label(buttonFrame, text=_("Find plug-in modules:"), wraplength=60, justify="center")
addLocalButton = Button(buttonFrame, text=_("Locally"), command=self.findLocally)
ToolTip(addLocalButton, text=_("File chooser allows selecting python module files to add (or reload) plug-ins, from the local file system."), wraplength=240)
addWebButton = Button(buttonFrame, text=_("On Web"), command=self.findOnWeb)
ToolTip(addWebButton, text=_("Dialog to enter URL full path to load (or reload) plug-ins, from the web or local file system."), wraplength=240)
addLabel.grid(row=0, column=0, pady=4)
addLocalButton.grid(row=1, column=0, pady=4)
addWebButton.grid(row=2, column=0, pady=4)
buttonFrame.grid(row=0, column=0, rowspan=2, sticky=(N, S, W), padx=3, pady=3)
# right tree frame (plugins already known to arelle)
modulesFrame = Frame(frame, width=700)
vScrollbar = Scrollbar(modulesFrame, orient=VERTICAL)
hScrollbar = Scrollbar(modulesFrame, orient=HORIZONTAL)
self.modulesView = Treeview(modulesFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=7)
self.modulesView.grid(row=0, column=0, sticky=(N, S, E, W))
self.modulesView.bind('<<TreeviewSelect>>', self.moduleSelect)
hScrollbar["command"] = self.modulesView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.modulesView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
modulesFrame.columnconfigure(0, weight=1)
modulesFrame.rowconfigure(0, weight=1)
modulesFrame.grid(row=0, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.modulesView.focus_set()
self.modulesView.column("#0", width=120, anchor="w")
self.modulesView.heading("#0", text=_("Name"))
self.modulesView["columns"] = ("author", "ver", "status", "date", "update", "descr", "license")
self.modulesView.column("author", width=100, anchor="w", stretch=False)
self.modulesView.heading("author", text=_("Author"))
self.modulesView.column("ver", width=50, anchor="w", stretch=False)
self.modulesView.heading("ver", text=_("Version"))
self.modulesView.column("status", width=50, anchor="w", stretch=False)
self.modulesView.heading("status", text=_("Status"))
self.modulesView.column("date", width=70, anchor="w", stretch=False)
self.modulesView.heading("date", text=_("File Date"))
self.modulesView.column("update", width=50, anchor="w", stretch=False)
self.modulesView.heading("update", text=_("Update"))
self.modulesView.column("descr", width=200, anchor="w", stretch=False)
self.modulesView.heading("descr", text=_("Description"))
self.modulesView.column("license", width=70, anchor="w", stretch=False)
self.modulesView.heading("license", text=_("License"))
classesFrame = Frame(frame)
vScrollbar = Scrollbar(classesFrame, orient=VERTICAL)
hScrollbar = Scrollbar(classesFrame, orient=HORIZONTAL)
self.classesView = Treeview(classesFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=5)
self.classesView.grid(row=0, column=0, sticky=(N, S, E, W))
hScrollbar["command"] = self.classesView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.classesView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
classesFrame.columnconfigure(0, weight=1)
classesFrame.rowconfigure(0, weight=1)
classesFrame.grid(row=1, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.classesView.focus_set()
self.classesView.column("#0", width=200, anchor="w")
self.classesView.heading("#0", text=_("Class"))
self.classesView["columns"] = ("modules",)
self.classesView.column("modules", width=500, anchor="w", stretch=False)
self.classesView.heading("modules", text=_("Modules"))
# bottom frame module info details
moduleInfoFrame = Frame(frame, width=700)
moduleInfoFrame.columnconfigure(1, weight=1)
self.moduleNameLabel = Label(moduleInfoFrame, wraplength=600, justify="left",
font=font.Font(family='Helvetica', size=12, weight='bold'))
self.moduleNameLabel.grid(row=0, column=0, columnspan=4, sticky=W)
self.moduleAuthorHdr = Label(moduleInfoFrame, text=_("author:"), state=DISABLED)
#.........这里部分代码省略.........
示例2: DialogPluginManager
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class DialogPluginManager(Toplevel):
def __init__(self, mainWin, modulesWithNewerFileDates):
super(DialogPluginManager, self).__init__(mainWin.parent)
self.ENABLE = _("Enable")
self.DISABLE = _("Disable")
self.parent = mainWin.parent
self.cntlr = mainWin
# copy plugins for temporary display
self.pluginConfig = PluginManager.pluginConfig
self.pluginConfigChanged = False
self.uiClassMethodsChanged = False
self.modulesWithNewerFileDates = modulesWithNewerFileDates
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", self.parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.title(_("Plug-in Manager"))
frame = Frame(self)
# left button frame
buttonFrame = Frame(frame, width=40)
buttonFrame.columnconfigure(0, weight=1)
addLabel = Label(buttonFrame, text=_("Find plug-in modules:"), wraplength=60, justify="center")
addLocalButton = Button(buttonFrame, text=_("Locally"), command=self.findLocally)
ToolTip(addLocalButton, text=_("File chooser allows selecting python module files to add (or reload) plug-ins, from the local file system."), wraplength=240)
addWebButton = Button(buttonFrame, text=_("On Web"), command=self.findOnWeb)
ToolTip(addWebButton, text=_("Dialog to enter URL full path to load (or reload) plug-ins, from the web or local file system."), wraplength=240)
addLabel.grid(row=0, column=0, pady=4)
addLocalButton.grid(row=1, column=0, pady=4)
addWebButton.grid(row=2, column=0, pady=4)
buttonFrame.grid(row=0, column=0, rowspan=2, sticky=(N, S, W), padx=3, pady=3)
# right tree frame (plugins already known to arelle)
modulesFrame = Frame(frame, width=700)
vScrollbar = Scrollbar(modulesFrame, orient=VERTICAL)
hScrollbar = Scrollbar(modulesFrame, orient=HORIZONTAL)
self.modulesView = Treeview(modulesFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=7)
self.modulesView.grid(row=0, column=0, sticky=(N, S, E, W))
self.modulesView.bind('<<TreeviewSelect>>', self.moduleSelect)
hScrollbar["command"] = self.modulesView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.modulesView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
modulesFrame.columnconfigure(0, weight=1)
modulesFrame.rowconfigure(0, weight=1)
modulesFrame.grid(row=0, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.modulesView.focus_set()
self.modulesView.column("#0", width=120, anchor="w")
self.modulesView.heading("#0", text=_("Name"))
self.modulesView["columns"] = ("author", "ver", "status", "date", "update", "descr", "license")
self.modulesView.column("author", width=100, anchor="w", stretch=False)
self.modulesView.heading("author", text=_("Author"))
self.modulesView.column("ver", width=50, anchor="w", stretch=False)
self.modulesView.heading("ver", text=_("Version"))
self.modulesView.column("status", width=50, anchor="w", stretch=False)
self.modulesView.heading("status", text=_("Status"))
self.modulesView.column("date", width=70, anchor="w", stretch=False)
self.modulesView.heading("date", text=_("File Date"))
self.modulesView.column("update", width=50, anchor="w", stretch=False)
self.modulesView.heading("update", text=_("Update"))
self.modulesView.column("descr", width=200, anchor="w", stretch=False)
self.modulesView.heading("descr", text=_("Description"))
self.modulesView.column("license", width=70, anchor="w", stretch=False)
self.modulesView.heading("license", text=_("License"))
classesFrame = Frame(frame)
vScrollbar = Scrollbar(classesFrame, orient=VERTICAL)
hScrollbar = Scrollbar(classesFrame, orient=HORIZONTAL)
self.classesView = Treeview(classesFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=5)
self.classesView.grid(row=0, column=0, sticky=(N, S, E, W))
hScrollbar["command"] = self.classesView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.classesView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
classesFrame.columnconfigure(0, weight=1)
classesFrame.rowconfigure(0, weight=1)
classesFrame.grid(row=1, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.classesView.focus_set()
self.classesView.column("#0", width=200, anchor="w")
self.classesView.heading("#0", text=_("Class"))
self.classesView["columns"] = ("modules")
self.classesView.column("modules", width=500, anchor="w", stretch=False)
self.classesView.heading("modules", text=_("Modules"))
# bottom frame module info details
moduleInfoFrame = Frame(frame, width=700)
moduleInfoFrame.columnconfigure(1, weight=1)
self.moduleNameLabel = Label(moduleInfoFrame, wraplength=600, justify="left",
font=font.Font(family='Helvetica', size=12, weight='bold'))
self.moduleNameLabel.grid(row=0, column=0, columnspan=4, sticky=W)
self.moduleAuthorHdr = Label(moduleInfoFrame, text=_("author:"), state=DISABLED)
self.moduleAuthorHdr.grid(row=1, column=0, sticky=W)
self.moduleAuthorLabel = Label(moduleInfoFrame, wraplength=600, justify="left")
self.moduleAuthorLabel.grid(row=1, column=1, columnspan=3, sticky=W)
#.........这里部分代码省略.........
示例3: DialogPackageManager
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class DialogPackageManager(Toplevel):
def __init__(self, mainWin, packageNamesWithNewerFileDates):
super(DialogPackageManager, self).__init__(mainWin.parent)
self.ENABLE = _("Enable")
self.DISABLE = _("Disable")
self.parent = mainWin.parent
self.cntlr = mainWin
# copy plugins for temporary display
self.packagesConfig = PackageManager.packagesConfig
self.packagesConfigChanged = False
self.packageNamesWithNewerFileDates = packageNamesWithNewerFileDates
parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", self.parent.geometry())
dialogX = int(parentGeometry.group(3))
dialogY = int(parentGeometry.group(4))
self.title(_("Taxonomy Packages Manager"))
frame = Frame(self)
# left button frame
buttonFrame = Frame(frame, width=40)
buttonFrame.columnconfigure(0, weight=1)
addLabel = Label(buttonFrame, text=_("Find taxonomy packages:"), wraplength=64, justify="center")
addLocalButton = Button(buttonFrame, text=_("Locally"), command=self.findLocally)
ToolTip(addLocalButton, text=_("File chooser allows selecting taxonomy packages to add (or reload), from the local file system. "
"Select either a taxonomy package zip file, or a taxonomy manifest (.taxonomyPackage.xml) within an unzipped taxonomy package. "), wraplength=240)
addWebButton = Button(buttonFrame, text=_("On Web"), command=self.findOnWeb)
ToolTip(addWebButton, text=_("Dialog to enter URL full path to load (or reload) package, from the web or local file system. "
"URL may be either a taxonomy package zip file, or a taxonomy manifest (.taxonomyPackage.xml) within an unzipped taxonomy package. "), wraplength=240)
manifestNameButton = Button(buttonFrame, text=_("Manifest"), command=self.manifestName)
ToolTip(manifestNameButton, text=_("Provide non-standard archive manifest file name pattern (e.g., *taxonomyPackage.xml). "
"Uses unix file name pattern matching. "
"Multiple manifest files are supported in archive (such as oasis catalogs). "
"(Replaces search for either .taxonomyPackage.xml or catalog.xml). "), wraplength=240)
self.manifestNamePattern = ""
addLabel.grid(row=0, column=0, pady=4)
addLocalButton.grid(row=1, column=0, pady=4)
addWebButton.grid(row=2, column=0, pady=4)
manifestNameButton.grid(row=3, column=0, pady=4)
buttonFrame.grid(row=0, column=0, rowspan=3, sticky=(N, S, W), padx=3, pady=3)
# right tree frame (packages already known to arelle)
packagesFrame = Frame(frame, width=700)
vScrollbar = Scrollbar(packagesFrame, orient=VERTICAL)
hScrollbar = Scrollbar(packagesFrame, orient=HORIZONTAL)
self.packagesView = Treeview(packagesFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=7)
self.packagesView.grid(row=0, column=0, sticky=(N, S, E, W))
self.packagesView.bind('<<TreeviewSelect>>', self.packageSelect)
hScrollbar["command"] = self.packagesView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.packagesView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
packagesFrame.columnconfigure(0, weight=1)
packagesFrame.rowconfigure(0, weight=1)
packagesFrame.grid(row=0, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.packagesView.focus_set()
self.packagesView.column("#0", width=120, anchor="w")
self.packagesView.heading("#0", text=_("Name"))
self.packagesView["columns"] = ("ver", "status", "date", "update", "descr")
self.packagesView.column("ver", width=150, anchor="w", stretch=False)
self.packagesView.heading("ver", text=_("Version"))
self.packagesView.column("status", width=50, anchor="w", stretch=False)
self.packagesView.heading("status", text=_("Status"))
self.packagesView.column("date", width=170, anchor="w", stretch=False)
self.packagesView.heading("date", text=_("File Date"))
self.packagesView.column("update", width=50, anchor="w", stretch=False)
self.packagesView.heading("update", text=_("Update"))
self.packagesView.column("descr", width=200, anchor="w", stretch=False)
self.packagesView.heading("descr", text=_("Description"))
remappingsFrame = Frame(frame)
vScrollbar = Scrollbar(remappingsFrame, orient=VERTICAL)
hScrollbar = Scrollbar(remappingsFrame, orient=HORIZONTAL)
self.remappingsView = Treeview(remappingsFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set, height=5)
self.remappingsView.grid(row=0, column=0, sticky=(N, S, E, W))
hScrollbar["command"] = self.remappingsView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.remappingsView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
remappingsFrame.columnconfigure(0, weight=1)
remappingsFrame.rowconfigure(0, weight=1)
remappingsFrame.grid(row=1, column=1, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.remappingsView.focus_set()
self.remappingsView.column("#0", width=200, anchor="w")
self.remappingsView.heading("#0", text=_("Prefix"))
self.remappingsView["columns"] = ("remapping")
self.remappingsView.column("remapping", width=500, anchor="w", stretch=False)
self.remappingsView.heading("remapping", text=_("Remapping"))
# bottom frame package info details
packageInfoFrame = Frame(frame, width=700)
packageInfoFrame.columnconfigure(1, weight=1)
self.packageNameLabel = Label(packageInfoFrame, wraplength=600, justify="left",
font=font.Font(family='Helvetica', size=12, weight='bold'))
self.packageNameLabel.grid(row=0, column=0, columnspan=6, sticky=W)
#.........这里部分代码省略.........
示例4: DialogOpenArchive
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class DialogOpenArchive(Toplevel):
def __init__(self, mainWin, openType, filesource, filenames, title, colHeader, showAltViewButton=False):
parent = mainWin.parent
super(DialogOpenArchive, self).__init__(parent)
self.parent = parent
self.showAltViewButton = showAltViewButton
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)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
hScrollbar["command"] = self.treeView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.treeView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
mainWin.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
self.selection = filesource.selection
self.hasToolTip = False
selectedNode = None
if openType == ENTRY_POINTS:
try:
metadataFiles = filesource.taxonomyPackageMetadataFiles
if len(metadataFiles) > 1:
raise IOError(_("Taxonomy package contained more than one metadata file: {0}.")
.format(', '.join(metadataFiles)))
metadataFile = metadataFiles[0]
metadata = filesource.file(filesource.url + os.sep + metadataFile)[0]
self.metadataFilePrefix = os.sep.join(os.path.split(metadataFile)[:-1])
if self.metadataFilePrefix:
self.metadataFilePrefix += os.sep
self.nameToUrls, self.remappings = parseTxmyPkg(mainWin, metadata)
except Exception as e:
self.close()
err = _("Failed to parse metadata; the underlying error was: {0}").format(e)
messagebox.showerror(_("Malformed taxonomy package"), err)
mainWin.addToLog(err)
return
mainWin.showStatus(None)
if openType == DISCLOSURE_SYSTEM:
y = 3
else:
y = 1
okButton = Button(frame, text=_("OK"), command=self.ok)
cancelButton = Button(frame, text=_("Cancel"), command=self.close)
okButton.grid(row=y, column=2, sticky=(S,E,W), pady=3)
cancelButton.grid(row=y, column=3, sticky=(S,E,W), pady=3, padx=3)
if showAltViewButton:
self.altViewButton = Button(frame, command=self.showAltView)
self.altViewButton.grid(row=y, column=0, sticky=(S,W), pady=3, padx=3)
self.loadTreeView(openType, colHeader, title)
frame.grid(row=0, column=0, sticky=(N,S,E,W))
frame.columnconfigure(0, 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.toolTipText = StringVar()
if self.hasToolTip:
self.treeView.bind("<Motion>", self.motion, '+')
self.treeView.bind("<Leave>", self.leave, '+')
self.toolTipText = StringVar()
self.toolTip = ToolTip(self.treeView,
textvariable=self.toolTipText,
wraplength=640,
follow_mouse=True,
state="disabled")
self.toolTipRowId = None
self.protocol("WM_DELETE_WINDOW", self.close)
self.grab_set()
self.wait_window(self)
def loadTreeView(self, openType, title, colHeader):
#.........这里部分代码省略.........
示例5: BioInfo
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class BioInfo(Tk):
def __init__(self):
Tk.__init__(self)
self.wm_title("BioInfo : comparaison des listes")
self.resizable(width=FALSE, height=FALSE)
self.SortDir = False
# Lists Types
self.typeList1 = None
self.typeList2 = None
# Frame content
self.frameContent = Frame(self)
self.frameContent.pack(side=TOP, fill=X)
# ScrollBar
scrollbar = Scrollbar(self.frameContent, orient=VERTICAL)
scrollbar.pack(side=RIGHT, fill=Y)
# Result Content
self.dataCols = ('microArn_A', 'microArn_B', 'FoldC', 'p-Value', 'Note')
self.tree = Treeview(self.frameContent, columns=self.dataCols, show = 'headings', yscrollcommand=scrollbar.set)
# configure column headings
for c in self.dataCols:
self.tree.heading(c, text=c, command=lambda c=c: self.columnSort(c, self.SortDir))
self.tree.column(c, width=10)
self.tree.pack(side=LEFT, fill=X, expand="yes")
scrollbar.config(command=self.tree.yview)
# Frame Lists
self.frameLists = Frame(self)
self.frameLists.pack(side=LEFT)
# Frame Forms
self.frameForms = Frame(self)
self.frameForms.pack(side=LEFT, padx=20)
#Liste n°1 selection
self.frameList1 = Frame(self.frameLists)
self.frameList1.pack()
self.typeListStr1 = StringVar(self.frameList1)
self.typeListStr1.set(str(ListBioType.TypeA))
self.buttonTypeList1 = OptionMenu(self.frameList1, self.typeListStr1, str(ListBioType.TypeA), str(ListBioType.TypeB)).pack(side=LEFT)
self.entrylist1 = Entry(self.frameList1, width=30)
self.entrylist1.pack(side=LEFT)
self.buttonBrowseList1 = Button(self.frameList1, text="Parcourir", command=self.load_fileList1, width=10)
self.buttonBrowseList1.pack(side=LEFT, padx=5)
# List n°2 selection
self.frameList2 = Frame(self.frameLists)
self.frameList2.pack(side=BOTTOM)
self.typeListStr2 = StringVar(self.frameList2)
self.typeListStr2.set(str(ListBioType.TypeB))
self.buttonTypeList2 = OptionMenu(self.frameList2, self.typeListStr2, str(ListBioType.TypeA), str(ListBioType.TypeB)).pack(side=LEFT)
self.entrylist2 = Entry(self.frameList2, width=30)
self.entrylist2.pack(side=LEFT)
self.buttonBrowseList2 = Button(self.frameList2, text="Parcourir", command=self.load_fileList2, width=10)
self.buttonBrowseList2.pack(side=LEFT, padx=5)
# Form pValue
self.framePVal = Frame(self.frameForms)
self.framePVal.pack()
Label(self.framePVal, text="pValue").pack(side=LEFT)
self.entryPVal = Entry(self.framePVal, width=6)
self.entryPVal.pack(side=LEFT)
# Form foldC
self.frameFoldC = Frame(self.frameForms)
self.frameFoldC.pack()
Label(self.frameFoldC, text="foldCh").pack(side=LEFT)
self.entryFoldC = Entry(self.frameFoldC, width=6)
self.entryFoldC.pack(side=LEFT)
# Form note
self.frameNote = Frame(self.frameForms)
self.frameNote.pack()
Label(self.frameNote, text="note ").pack(side=LEFT)
self.entryNote = Entry(self.frameNote, width=6)
self.entryNote.pack(side=LEFT)
# Bouton comparer
self.buttonComparer = Button(self, text="Comparer", command=self.compare, width=10, state=DISABLED)
self.buttonComparer.pack(fill= X, expand="yes", padx=20, pady=(10,0))
#Bouton exporter
self.buttonExport = Button(self, text="Exporter", command=self.export, width=10, state=DISABLED)
#.........这里部分代码省略.........
示例6: Gr
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class Gr():
def __init__(self,root,data,SCRY=None):
self.data=data
self.columns=[x for x in range(1,8)]+['day']
root.rowconfigure(1,weight=1)
root.columnconfigure(0,weight=1)
root.columnconfigure(1,weight=1)
root.columnconfigure(2,weight=1)
f=Frame(root)
f.columnconfigure(0,weight=1)
f.rowconfigure(1,weight=1)
self.v=Combobox(root)
self.v.grid(row=0,column=0)
self.v.bind('<<ComboboxSelected>>',self.select_ver)
f.grid(row=1,column=0,columnspan=3,sticky=N+S)
self.tree=Treeview(f,
columns=self.columns,
displaycolumns=['day']+self.columns[:-1],
show='headings')
#self.tree.tag_configure('odd',background='white')
#self.tree.tag_configure('even',background='gray')
self.tree.tag_configure('dif',foreground='brown')
self.tree.tag_configure('work',background='white')
self.tree.tag_configure('short',background='#F5EFE0')
self.tree.tag_configure('rest',background='#E0B0B0')
self.tree.tag_configure('holyday',background='#E7B7A4')
for c in self.columns:
self.tree.heading(c,text=c)
self.tree.column(c,width=65,anchor='center')
self.tree.column('day',width=30)
scrX=Scrollbar(f,orient='horizontal',command=self.tree.xview)
self.tree['xscrollcommand']=scrX.set
if not SCRY:
self.scrY=Scrollbar(f,orient='vertical',command=self.yview)
self.tree['yscrollcommand']=self.scrY.set
else:
self.tree['yscrollcommand']=SCRY.set
self.tree.grid(row=1,column=0,sticky=N+S)
if not SCRY:
self.scrY.grid(row=1,column=1,sticky=N+S)
scrX.grid(row=2,column=0,sticky=E+W)
def set(self,y,m):
self.y=y
self.m=m
self.show()
def yview(self,*args):
self.tree.yview(*args)
self.yview2(*args)
def yview2(self,*args):
pass
def show(self):
d=self.data[self.y][self.m]
V=list(d['degur'].keys())
self.v['values']=V
self.v.set(V[0])
self.select_ver()
def select_ver(self,*e):
self.tree.delete(*self.tree.get_children())
d=self.data[self.y][self.m]
offset=d['offset']
v=self.v.get()
col=[]
for i,deg in enumerate(d['degurs']):
self.tree.heading(i+1,text=deg)
col.append(i+1)
self.tree.configure(displaycolumns=['day']+col)
items=dict()
if 'табель' in d['degur']:
a=[''.join(x) for x in zip(*[[x for x in d['degur']['план'][j]] \
for j in d['degurs']])]
b=[''.join(x) for x in zip(*[[x for x in d['degur']['табель'][j]] \
for j in d['degurs']])]
c=[x!=y for x,y in zip(a,b)]
else:
c=[False]*32
for i in range(1,d['days']+1):
tag = (i+offset) % 7 in [0,6] and 'rest' or 'work'
if i in d['holydays'] : tag='holyday'
elif i in d['restdays'] : tag='rest'
elif i in d['shortdays'] : tag='short'
elif i in d['workdays'] : tag='work'
if c[i]: tag=[tag,'dif']
ii=self.tree.insert('','end',values=['-','-','-','-','-'],tag=tag)
self.tree.set(ii,column='day',value=i)
items[i]=ii
for j,s in d['degur'][v].items(): # j-degur
if not s: continue
for i,val in enumerate(s[1:-1]):
if val=='J':
val='до'
elif val=='j':
val='од'
elif val=='a':
val='10'
self.tree.set(items[i+1],column=d['degurs'].index(j)+1,value=val)
if s[0]=='Н':
#.........这里部分代码省略.........
示例7: ElementListWidget
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
#.........这里部分代码省略.........
.grid(column = 0, row = 0)
Label(self.selectedFrame, textvariable = self.i, width = 3, justify = RIGHT) \
.grid(column = 1, row = 0)
# Пустое пространство
self.selectedFrame.columnconfigure(2, minsize = emptySpaceSize, weight = 0)
# Метка
Entry(self.selectedFrame, textvariable = self.label[0]) \
.grid(column = 3, row = 0, sticky = W + E)
Entry(self.selectedFrame, textvariable = self.label[1], bg = defaultValueBG) \
.grid(column = 4, row = 0, sticky = W + E)
# Виджет для элементов классов-потомков
self.detailFrame = Frame(self.selectedFrame)
self.detailFrame.grid(column = 3, row = 1, columnspan = 2, sticky = W + N + E + S)
self.selectedFrame.columnconfigure(3, weight = 1)
self.selectedFrame.columnconfigure(4, weight = 1)
self.selectedFrame.rowconfigure(1, weight = 1)
def onButtonUpClicked(self):
item = self.selectedItem()
if item is None: return
prev = self.tree.prev(item)
if prev != "":
parent, index = self.tree.parent(item), self.tree.index(item)
self.tree.move(item, parent, index - 1)
# Корректируем номера элементов
self.tree.set(item, "№", index - 1)
self.tree.set(prev, "№", index)
self.updateSelectedFrame(item)
def onButtonDownClicked(self):
item = self.selectedItem()
if item is None: return
next = self.tree.next(item)
if next != "":
parent, index = self.tree.parent(item), self.tree.index(item)
self.tree.move(item, parent, index + 1)
# Корректируем номера элементов
self.tree.set(item, "№", index + 1)
self.tree.set(next, "№", index)
self.updateSelectedFrame(item)
def onButtonAddClicked(self):
pass
def onButtonRemoveClicked(self):
item = self.selectedItem()
if item is None: return
next = self.tree.next(item)
self.tree.delete(item)
示例8: DialogOpenArchive
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import set [as 别名]
class DialogOpenArchive(Toplevel):
def __init__(self, parent, openType, filesource, filenames, title, colHeader, showAltViewButton=False):
if isinstance(parent, Cntlr):
cntlr = parent
parent = parent.parent # parent is cntlrWinMain
else: # parent is a Toplevel dialog
cntlr = parent.cntlr
super(DialogOpenArchive, self).__init__(parent)
self.parent = parent
self.showAltViewButton = showAltViewButton
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)
frame = Frame(self)
treeFrame = Frame(frame, width=500)
vScrollbar = Scrollbar(treeFrame, orient=VERTICAL)
hScrollbar = Scrollbar(treeFrame, orient=HORIZONTAL)
self.treeView = Treeview(treeFrame, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
self.treeView.grid(row=0, column=0, sticky=(N, S, E, W))
hScrollbar["command"] = self.treeView.xview
hScrollbar.grid(row=1, column=0, sticky=(E,W))
vScrollbar["command"] = self.treeView.yview
vScrollbar.grid(row=0, column=1, sticky=(N,S))
treeFrame.columnconfigure(0, weight=1)
treeFrame.rowconfigure(0, weight=1)
treeFrame.grid(row=0, column=0, columnspan=4, sticky=(N, S, E, W), padx=3, pady=3)
self.treeView.focus_set()
if openType not in (PLUGIN, PACKAGE):
cntlr.showStatus(_("loading archive {0}").format(filesource.url))
self.filesource = filesource
self.filenames = filenames
self.selection = filesource.selection
self.hasToolTip = False
selectedNode = None
if openType == ENTRY_POINTS:
try:
metadataFiles = filesource.taxonomyPackageMetadataFiles
''' take first for now
if len(metadataFiles) != 1:
raise IOError(_("Taxonomy package contained more than one metadata file: {0}.")
.format(', '.join(metadataFiles)))
'''
metadataFile = metadataFiles[0]
metadata = filesource.url + os.sep + metadataFile
self.metadataFilePrefix = os.sep.join(os.path.split(metadataFile)[:-1])
if self.metadataFilePrefix:
self.metadataFilePrefix += "/" # zip contents have /, never \ file seps
self.taxonomyPkgMetaInf = '{}/META-INF/'.format(
os.path.splitext(os.path.basename(filesource.url))[0])
self.taxonomyPackage = parsePackage(cntlr, filesource, metadata,
os.sep.join(os.path.split(metadata)[:-1]) + os.sep)
if self.taxonomyPackage["entryPoints"]:
# may have instance documents too
self.packageContainedInstances = []
packageContentTypeCounts = {}
for suffix in (".xhtml", ".htm", ".html"):
for potentialInstance in filesource.dir:
if potentialInstance.endswith(".xhtml"):
_type = "Inline Instance"
self.packageContainedInstances.append([potentialInstance, _type])
packageContentTypeCounts[potentialInstance] = packageContentTypeCounts.get(potentialInstance, 0) + 1
if self.packageContainedInstances:
break
if self.packageContainedInstances: # add sequences to any duplicated entry types
for _type, count in packageContentTypeCounts.items():
if count > 1:
_dupNo = 0
for i in range(len(self.packageContainedInstances)):
if self.packageContainedInstances[i][0] == _type:
_dupNo += 1
self.packageContainedInstances[i][0] = "{} {}".format(_type, _dupNo)
else:
# may be a catalog file with no entry oint names
openType = ARCHIVE # no entry points to show, just archive
self.showAltViewButton = False
except Exception as e:
self.close()
err = _("Failed to parse metadata; the underlying error was: {0}").format(e)
messagebox.showerror(_("Malformed taxonomy package"), err)
cntlr.addToLog(err)
return
if openType not in (PLUGIN, PACKAGE):
cntlr.showStatus(None)
if openType in (DISCLOSURE_SYSTEM, PLUGIN, PACKAGE):
y = 3
else:
#.........这里部分代码省略.........