本文整理汇总了Python中tkinter.ttk.Treeview.column方法的典型用法代码示例。如果您正苦于以下问题:Python Treeview.column方法的具体用法?Python Treeview.column怎么用?Python Treeview.column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Treeview
的用法示例。
在下文中一共展示了Treeview.column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
class MainWindow(Frame):
"""
Macro class for the main program window
"""
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title('PyNBTx %s' % __version__)
self.style = Style()
self.style.theme_use('default')
self.style.configure('TButton', padding=0)
self.pack(fill=BOTH, expand=1)
self.menu = MainMenu(root)
self.toolbar = ToolBar(self)
self.tree = Treeview(self, height=20)
self.tree_display = TreeDisplay(self.tree)
self.ui_init()
def ui_init(self):
root['menu'] = self.menu
self.toolbar.pack(anchor=NW, padx=4, pady=4)
self.tree.column('#0', width=300)
self.tree.pack(fill=BOTH, anchor=NW, padx=4, pady=4)
示例2: Mk_Book_display
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
def Mk_Book_display(book, name):
w = book.page(name)
disp = Frame(w)
tree_columns = ('book_no', 'book_name', 'book_author', 'book_publisher', 'in_out_status')
Entries=Treeview( disp,
columns=tree_columns,
show="headings"
)
global_bucket['book_shelf'] = Entries
vsb = Scrollbar ( disp,
orient="vertical",
command=Entries.yview)
Entries.configure(yscrollcommand=vsb.set)
for col,width in zip(tree_columns,(4,20,10,5,6)):
Entries.heading(col, text=col.title(), anchor='w')
Entries.column(col, width=1)
vsb.pack(side=RIGHT,fill=Y)
Entries.pack(fill=BOTH, expand=1)
disp.pack(fill=BOTH, expand=1)
update()
示例3: per
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
class per():
def __init__(self,data,y,v='план'):
w=Toplevel()
w.wm_title('Доп')
w.columnconfigure(0,weight=1)
w.rowconfigure(0,weight=1)
years=sorted(data.keys())
cols=data['2013']['degurs'] # ЗАГЛУШКА : список дежурных
self.t=Treeview(w,columns=cols)
for c in cols:
self.t.heading(c,text=c)
self.t.column(c,width=65,anchor='center')
self.t.tag_configure('табель',background='green')
self.t.tag_configure('ош',background='red')
#self.t.tag_configure('табель',background='green')
self.scrX=Scrollbar(w,orient='horizontal',command=self.t.xview)
self.scrY=Scrollbar(w,orient='vertical',command=self.t.yview)
self.t['xscrollcommand']=self.scrX.set
self.t['yscrollcommand']=self.scrY.set
self.t.grid(row=0,column=0,sticky=N+S+E+W)
self.scrX.grid(row=1,column=0,sticky=E+W)
self.scrY.grid(row=0,column=1,sticky=N+S)
for y in years:
x=self.t.insert('','end',text=y)
eeY=[]
for m in ['01','02','03','04','05','06','07','08','09','10','11','12']:
d0=data[y]
if m not in d0: continue
d=d0[m]
rez=dict()
tag=''
if v=='авто':
if 'табель' in d['degur']:
vv='табель'
tag=vv
else:
vv='план'
elif v=='табель':
if 'табель' not in d['degur']:
vv='план'
tag='ош'
else:
vv=v
tag=vv
else:
vv=v
for j,s in d['degur'][vv].items():
rez[j]=analyse2(s,d)
NUL=(0,0,0,0,0,0,0)
ee=[rez.get(j,NUL)[0]-rez.get(j,NUL)[3]+rez.get(j,NUL)[4] for j in cols]
eeY.append(ee)
self.t.insert(x,'end',text=m,values=[x or '-' for x in ee],tag=tag)
eeY=[sum(x) for x in zip(*eeY)]
self.t.insert(x,'end',text='итого',values=eeY,tag='Y')
示例4: CreateUI
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
def CreateUI(self, classInstance):
self.headers = [
"Customers",
"Inter-arrival time",
"Arrival time",
"Service time",
"Waiting time in queue",
"Time when service begins",
"Time when service ends",
"Time customer spends in system",
"Idle time of server"
]
self.contents =[]
# populates the table from other class to generate the tkinter table
def compilelist(classInstance):
self.contents.append(classInstance.intarrival())
self.contents.append(classInstance.arrival())
self.contents.append(classInstance.service())
self.contents.append(classInstance.queuewait())
self.contents.append(classInstance.servbegin())
self.contents.append(classInstance.servend())
self.contents.append(classInstance.custspend())
self.contents.append(classInstance.idle())
return self.contents
# Calling the function
compilelist(classInstance)
self.rearrange = []
for row in zip(*self.contents):
self.rearrange.append(row)
self.headdata = []
for x in range(len(self.contents[0])):
self.headdata.append(x+1)
header_lists = []
tv = Treeview(self)
tv['columns'] = (self.headers)
for x in range(len(self.headers)):
tv.heading("#%s"%x, text=self.headers[x], anchor='center')
tv.column ("#%s"%x, anchor='center', width="150")
tv.grid(sticky = (N,S,W,E))
self.treeview = tv
self.grid_rowconfigure(0, weight = 1)
self.grid_columnconfigure(0, weight = 1)
示例5: Mk_Status_display
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
def Mk_Status_display(book, name):
w = book.page(name)
disp = Frame(w)
tree_columns = ('book_no', 'book_name', 'date', 'staff_id', 'staff_name', 'note')
Entries=Treeview( disp,
columns=tree_columns,
show="headings",
)
global_bucket['status_register'] = Entries
vsb = Scrollbar ( disp,
orient="vertical",
command=Entries.yview)
Entries.configure(yscrollcommand=vsb.set)
for col in tree_columns:
Entries.heading(col, text=col.title(), anchor='w')
Entries.column(col, width=0)
vsb.pack(side=RIGHT,fill=Y)
Entries.pack(fill=BOTH, expand=1)
disp.pack(fill=BOTH, expand=1)
update()
示例6: DialogPluginManager
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [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)
#.........这里部分代码省略.........
示例7: ComponentsDumpWindow
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
class ComponentsDumpWindow(Toplevel):
def __init__(self, application, barNumber = None, **kwargs):
Toplevel.__init__(self)
self.application = application
self.barNumber = barNumber
self.fromLabel = Label(self)
self.fromLabel.grid(column = 0, row = 0)
self.fromVar = StringVar()
self.fromEntry = Entry(self, textvariable = self.fromVar, justify = RIGHT)
self.fromEntry.grid(column = 1, row = 0, sticky = W + E)
self.columnconfigure(1, weight = 1)
self.toLabel = Label(self)
self.toLabel.grid(column = 2, row = 0)
self.toVar = StringVar()
self.toEntry = Entry(self, textvariable = self.toVar, justify = RIGHT)
self.toEntry.grid(column = 3, row = 0, sticky = W + E)
self.columnconfigure(3, weight = 1)
self.stepLabel = Label(self, text = "dx:")
self.stepLabel.grid(column = 4, row = 0)
self.stepVar = StringVar()
self.stepEntry = Entry(self, textvariable = self.stepVar, justify = RIGHT)
self.stepEntry.grid(column = 5, row = 0, sticky = W + E)
self.columnconfigure(5, weight = 1)
self.calculateButton = Button(self, text = "Рассчитать",
command = self.onCalculateButtonClicked)
self.calculateButton.grid(column = 6, row = 0, columnspan = 2)
# Таблица рассчитанных значений
columns = ("№ стержня", "x", "Nx", "U", "σ")
self.tree = Treeview(self, columns = columns, displaycolumns = columns)
self.tree.grid(column = 0, row = 1, columnspan = 7, sticky = W + N + E + S)
self.tree.column("#0", width = 0, stretch = 0)
# Настройки отображения таблицы
self.tree.column(columns[0], anchor = CENTER)
self.tree.heading(columns[0], text = columns[0], anchor = CENTER)
for x in columns[1:]:
self.tree.column(x, anchor = E)
self.tree.heading(x, text = x, anchor = E)
self.rowconfigure(1, weight = 1)
self.bind("<Destroy>", self.onWindowDestroy)
self.updateTitles()
self.onConstructionChanged(False)
def updateTitles(self):
if self.barNumber is None:
titleDescStr = ""
xDescStr = "global"
else:
titleDescStr = "%sСтержень (%d)" % (self.application.nameDelim, self.barNumber)
xDescStr = "local"
self.title("%s%sКомпоненты%s" \
% (self.application.name, self.application.nameDelim, titleDescStr))
self.fromLabel["text"] = "От x(" + xDescStr + "):"
self.toLabel["text"] = "До x(" + xDescStr + "):"
def onWindowDestroy(self, event):
self.application.onWindowDestroy(self)
def onCalculateButtonClicked(self):
try:
self.calculate()
except Exception as e:
self.showError(e)
def onConstructionChanged(self, constructed = True):
if not constructed:
for var in self.fromVar, self.toVar, self.stepVar:
var.set("0")
return
try:
self.calculate()
except Exception:
#.........这里部分代码省略.........
示例8: DialogOpenArchive
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [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):
#.........这里部分代码省略.........
示例9: BioInfo
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [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)
#.........这里部分代码省略.........
示例10: Expenses
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
#.........这里部分代码省略.........
def addToDatabase(self):
self.inventoryDB.insertInvetory(self.item)
return self.successful()
# Displays a success message when the item is added
def successful(self):
self.master.title("%s was added successfully!" % self.item.name)
succMessage = Message(root, text = "%s was successfully added to the %s list!" % (self.item.name, self.item.itemType))
succMessage.place(x = 150, y = 150)
startOverButton = Button(root, text = "Start Over", command=lambda: self.sequence(self.createOptionButtons))#self.saveNameAndType(itemName)))#(self.saveNameAndType(itemName))) # (itemName)))# lambda: self.sequence(self.test)) #This button will send the user to the add inventory page
startOverButton.place(x = 150, y = 350)
# Used to view the inventory
def viewInveroty(self):
# Creates the label called chooseTypeLabel and a drop down menu called chooseItemType
chooseTypeLabel = Label(root, text = "Item's type: ")
chooseTypeLabel.place(x = 110, y = 160)
self.chooseItemType = StringVar(root) # The drop down menu is created and assigned to chooseItemType
self.chooseItemType.set("Tree") # Tree is set to the default option in the drop down menu
typeChoices = OptionMenu(root, self.chooseItemType, "Tree", "Animal", "Machine", "All") # Options Tree, Animal, Machine, and ALL are added to the drop down menu
typeChoices.place(x = 190, y = 160)
backButton = Button(root, text = "Back", command=lambda: self.sequence(self.createOptionButtons)) # This button will return the user to the expenses option page
backButton.place(x = 50, y = 350)
nextButton = Button(root, text = "Next", command=lambda: self.sequence(self.displayGeneralInventory))#self.saveNameAndType(itemName)))#(self.saveNameAndType(itemName))) # (itemName)))# lambda: self.sequence(self.test)) #This button will send the user to the add inventory page
nextButton.place(x = 350, y = 350)
# Used to create the inventory table
def displayGeneralInventory(self):
# This creates a table using the function Treeview
self.tree = Treeview(height="20", columns=("Name", "Current Quantity"))
self.tree.pack()
self.tree.heading('#1', text = "Name", anchor = CENTER)
self.tree.heading('#2', text = "Current Quantity", anchor = CENTER)
self.tree.column('#1', minwidth=0, width = 100)
self.tree.column('#2', minwidth=0, width = 100)
self.tree.column('#0', minwidth=0, width = 0)
itemType = self.chooseItemType.get()
if(itemType == "All"):
self.obtainData("Tree")
self.obtainData("Animal")
self.obtainData("Machine")
else:
self.obtainData(itemType)
# Adds database data to the inventory table
def obtainData(self, type):
for row in (self.inventoryDB.getOverviewInventory(type)):
name = row[0]
totalQuantity = row[1]
# Inserts data into the table. Each entry is tagged with the name and the type
# This is done in order to make identifying the entries easier for when detailed
# tables are requested
self.tree.insert("", "end", values = (name,totalQuantity), tag= [name, type])
# Creates a bak function that is used in the displayGeneralInventory functions
self.backFunction = self.displayGeneralInventory
# Binds a double click function to the Treeview table. If an entry is double clicked,
示例11: hyGUI
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
#.........这里部分代码省略.........
self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
self._resultLabel.pack()
## Worst item sold button
self._worstItemButton = Button(self, text="Worst Item Sold", command=self._worstItem)
self._worstItemButton.pack()
self._resultVar = StringVar()
self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
self._resultLabel.pack()
## Best sales per game button
self._itemButton = Button(self, text="Game for best Sales", command=self._item)
self._itemButton.pack()
## this button is not packed but, it is needed to populate the table
self._tableButton = Button(self, text = "Show the Complete table", command =self._maketable())
self._resultVar = StringVar()
self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
self._resultLabel.pack()
## Using empty sting label to display the different text on GUI Frame when clicking button
self.resultBestLabel = Label(self, text = "")
self.resultBestLabel.pack()
self._treeview['columns']=('location', 'date', 'no_hats', 'val_hats', 'no_jerseys', 'val_jerseys',
'no_hockstick', 'val_hockstick', 'no_posters', 'val_posters','total_sales')
## Creating a columns name heading for the table
self._treeview.heading('location', text = "Location")
self._treeview.column('#0', width = 0)
self._treeview.heading('date', text = "Date")
self._treeview.heading('no_hats', text = "# hats")
self._treeview.heading('val_hats', text = "$ hats")
self._treeview.heading('no_jerseys', text = "# jerseys")
self._treeview.heading('val_jerseys', text = "$ jerseys")
self._treeview.heading('no_hockstick', text = "# hockey stick")
self._treeview.heading('val_hockstick', text = "$ hockey stick")
self._treeview.heading('no_posters', text = "# posters")
self._treeview.heading('val_posters', text = "$ posters")
self._treeview.heading('total_sales', text = "Total Sales")
## The column size is 100
for item in self._treeview['columns']:
self._treeview.column(item, width = 100)
self._treeview.pack()
## Calling for database table to be displayed on GUI frame
def _maketable(self):
makeTableDatabase(self)
示例12: digiclock
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
#.........这里部分代码省略.........
if (ct[3].split(':')[0] == '00' ):
ct[3]='12' + ct[3][2:]
ConfigEvents()
#~ if (not int(ct[3].split(':')[2])%10): ts.config( bg=colour[ int( int( ct[3].split(':')[2] )/10) ] )
mhs=ct[3].split(':')
mode= {
'time&date' :'%s-%s-%s\n%s\n%0.2d:%0.2d:%0.2d %s'%(ct[1],ct[2],ct[4],day[ct[0]],int(mhs[0]),int(mhs[1]),int(mhs[2]),m),
'time' :'%0.2d:%0.2d:%0.2d %s'%(int(mhs[0]),int(mhs[1]),int(mhs[2]),m)
}
text =mode['time&date']
#~ print(ct)
ts.config(text=text)
#~ print(al_time,mode['time'],al_time==mode['time'])
if(al_time==mode['time']):
set.config( text='Stop' )
cal.config( text='Expired @ ' + al_time[:-2] )
thread.start_new_thread(lambda snd='ringout', repeat=ON :play( snd, repeat ) ,() )
sleep(1)
def sett():
global al_status,sound_continueous,al_time
if(al_status):
al_status = OFF
sound_continueous = OFF
al_time = ''
cal.config( text='No Alarm' )
set.config( text='Set' )
else:
al_status = ON
al_time = at.entry.get()+' '+ampm.entry.get()
cal.config( text='Set @ ' + al_time )
set.config( text='Remove' )
bg='orange'
#~ time frame
tf=Frame( f1, bg='black' )
ts=Label( tf
,text="rajiv.m1991\[email protected]\ngmail.com"
,font='times 40'
,bg='violet'
,width=11
,fg='white')
tf.pack(fill=BOTH)
ts.pack(fill=X)
#~ alarm frame
af=Frame(f2f1,bg=bg)
al=Label( af
,text="$ Alarm $"
,font='times'
,fg='white'
,bg='black')
at=LabelEntry( af, label='HH:MM:SS', bg=bg )
at.label.config( fg='white', bg=bg )
at.entry.config( width=13, borderwidth=0 )
at.entry.insert( 0, '00:00:00' )
ampm=LabelEntry( af, label='AM / PM ', bg=bg )
ampm.entry.config( borderwidth=0 )
ampm.label.config( fg='white', bg=bg)
if( int( ctime().split(' ')[3].split(':')[0]) > 11 ): ampm.entry.insert( 0,'PM' )
else: ampm.entry.insert( 0, 'AM' )
set=Button(af
,text='Set'
,command=sett
,fg='brown')
ast=Label( af
,text='Alarm status:'
,fg='white'
,bg=bg
,anchor='sw')
cal=Label( af
,text='No Alarm'
,fg='white'
,bg='black'
,anchor='sw')
af.pack(fill=BOTH)
al.pack(fill=X)
at.pack(fill=X,padx=5,pady=5)
ampm.pack(fill=X,padx=5,pady=5)
set.pack()
ast.pack(fill=X)
cal.pack(fill=X)
#~ options
L=Label(f2f2,text="Upcoming Events")
L.pack(fill=X)
tree_columns = ("Dt", "Note", "Category")
Entries=Treeview( f2f2,
columns=tree_columns,
show="headings",
height=5)
vsb = Scrollbar(f2f2,orient="vertical", command=Entries.yview)
Entries.configure(yscrollcommand=vsb.set)
for col in tree_columns:
Entries.heading(col, text=col.title())
Entries.column(tree_columns[0],width=20)
Entries.column(tree_columns[1],width=75)
Entries.column(tree_columns[2],width=75)
vsb.pack(side=RIGHT,fill=Y)
Entries.pack(fill=BOTH)
#~ start clock
ConfigEvents()
thread.start_new_thread(lambda st=ts_status ,ts=ts : displayTime(st,ts),())
print('Digital Clock Successfully built')
示例13: DialogPackageManager
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [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)
#.........这里部分代码省略.........
示例14: statistic_xx
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
class statistic_xx():
def __init__(self,data,y,v='план'):
w=Toplevel()
w.wm_title('Итоги по месяцам за {0} год ({1}) '.format(y,v))
w.columnconfigure(0,weight=1)
w.rowconfigure(0,weight=1)
cols=data[y]['degurs'] # ЗАГЛУШКА : список дежурных
self.t=Treeview(w,columns=cols)
self.t.column('#0',width=120)
for c in cols:
self.t.heading(c,text=c)
self.t.column(c,width=65,anchor='center')
self.t.tag_configure('табель',background='green')
self.t.tag_configure('ош',background='red')
self.scrX=Scrollbar(w,orient='horizontal',command=self.t.xview)
self.scrY=Scrollbar(w,orient='vertical',command=self.t.yview)
self.t['xscrollcommand']=self.scrX.set
self.t['yscrollcommand']=self.scrY.set
self.t.grid(row=0,column=0,sticky=N+S+E+W)
self.scrX.grid(row=1,column=0,sticky=E+W)
self.scrY.grid(row=0,column=1,sticky=N+S)
roots=dict()
for m in ['01','02','03','04','05','06','07','08','09','10','11','12']:
d0=data[y]
if m not in d0: continue
roots[m]=self.t.insert('','end',text=m+' ('+data[y][m]['month']+')')
#r=self.t.insert('','end',text='рабочих')
#x=self.t.insert('','end',text='xxx')
#w=self.t.insert('','end',text='отработано')
#e=self.t.insert('','end',text='дополнительные')
#n=self.t.insert('','end',text='ночные')
#h=self.t.insert('','end',text='праздничные')
#rz_root=self.t.insert('','end',text='резерв')
for m in ['01','02','03','04','05','06','07','08','09','10','11','12']:
d0=data[y]
if m not in d0: continue
d=d0[m]
rez=dict()
tag=''
if v=='авто':
if 'табель' in d['degur']:
vv='табель'
tag=vv
else:
vv='план'
elif v=='табель':
if 'табель' not in d['degur']:
vv='план'
tag='ош'
else:
vv=v
tag=vv
else:
vv=v
for j,s in d['degur'][vv].items():
rez[j]=analyse2(s,d)
NUL=(0,0,0,0,0,0,0)
ww=[rez.get(j,NUL)[0] for j in cols]
ee=[rez.get(j,NUL)[0]-rez.get(j,NUL)[3]+rez.get(j,NUL)[4] for j in cols]
xx=[rez.get(j,NUL)[0]-rez.get(j,NUL)[3] for j in cols]
nn=[rez.get(j,NUL)[1] for j in cols]
hh=[rez.get(j,NUL)[2] for j in cols]
rr=[rez.get(j,NUL)[3]-rez.get(j,NUL)[4] for j in cols]
rz=[rez.get(j,NUL)[5] for j in cols]
self.t.insert(roots[m],'end',text='отработано',values=ww,tag=tag)
self.t.insert(roots[m],'end',text='рабочие',values=rr,tag=tag)
self.t.insert(roots[m],'end',text='дополнительные',values=ee,tag=tag)
self.t.insert(roots[m],'end',text='ночные',values=nn,tag=tag)
self.t.insert(roots[m],'end',text='праздничные',values=hh,tag=tag)
示例15: statistic_q
# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import column [as 别名]
class statistic_q():
def __init__(self,data,y,v='план'):
w=Toplevel()
w.wm_title('Поквартальная статистика за {0} год ({1})'.format(y,v))
w.columnconfigure(0,weight=1)
w.rowconfigure(0,weight=1)
cols=data[y]['degurs'] # ЗАГЛУШКА : список дежурных
self.t=Treeview(w,columns=cols)
self.t.column('#0',width=120)
for c in cols:
self.t.heading(c,text=c)
self.t.column(c,width=65,anchor='center')
self.t.tag_configure('табель',background='green')
self.t.tag_configure('ош',background='red')
self.scrX=Scrollbar(w,orient='horizontal',command=self.t.xview)
self.scrY=Scrollbar(w,orient='vertical',command=self.t.yview)
self.t['xscrollcommand']=self.scrX.set
self.t['yscrollcommand']=self.scrY.set
self.t.grid(row=0,column=0,sticky=N+S+E+W)
self.scrX.grid(row=1,column=0,sticky=E+W)
self.scrY.grid(row=0,column=1,sticky=N+S)
r=self.t.insert('','end',text='рабочих')
w=self.t.insert('','end',text='отработано')
e=self.t.insert('','end',text='дополнительные')
n=self.t.insert('','end',text='ночные')
h=self.t.insert('','end',text='праздничные')
x=self.t.insert('','end',text='xxx')
rz_root=self.t.insert('','end',text='резерв')
rez=dict()
wwY=[]
rrY=[]
eeY=[]
xxY=[]
nnY=[]
hhY=[]
rzY=[]
for mm in [1,2,3,4]:
mmm=[str((mm-1)*3+x).zfill(2) for x in [1,2,3]]
mmm=[x for x in mmm if x in data[y]]
tag=''
k=['табель' in data[y][m]['degur'] for m in mmm]
#print(k)
if v=='авто':
if k==[True, True, True]:
vv='табель'
tag=vv
else:
vv='план'
elif v=='табель':
if k!=[True, True, True]:
vv='план'
tag='ош'
else:
vv=v
tag=vv
else:
vv=v
ww=[]
rr=[]
ee=[]
xx=[]
nn=[]
hh=[]
rz=[]
for m in mmm:
d=data[y][m]
for j in cols:
s=d['degur'][vv].get(j,'*ООООООООООООООООООООООООООООООО*')
rez[j]=analyse2(s,d)
NUL=(0,0,0,0,0,0,0)
ww.append([rez.get(j,NUL)[0] for j in cols])
ee.append([rez.get(j,NUL)[0]-rez.get(j,NUL)[3] + \
rez.get(j,NUL)[4] for j in cols])
xx.append([rez.get(j,NUL)[0]-rez.get(j,NUL)[3] for j in cols])
rr.append([rez.get(j,NUL)[3]-rez.get(j,NUL)[4] for j in cols])
nn.append([rez.get(j,NUL)[1] for j in cols])
hh.append([rez.get(j,NUL)[2] for j in cols])
rz.append([rez.get(j,NUL)[5] for j in cols])
ww=[sum(x) for x in zip(*ww)]
rr=[sum(x) for x in zip(*rr)]
ee=[sum(x) for x in zip(*ee)]
xx=[sum(x) for x in zip(*xx)]
nn=[sum(x) for x in zip(*nn)]
hh=[sum(x) for x in zip(*hh)]
rz=[sum(x) for x in zip(*rz)]
wwY.append(ww)
rrY.append(rr)
eeY.append(ee)
xxY.append(xx)
nnY.append(nn)
hhY.append(hh)
rzY.append(rz)
self.t.insert(w,'end',text=mm,values=ww,tag=tag)
self.t.insert(r,'end',text=mm,values=rr,tag=tag)
#.........这里部分代码省略.........