本文整理汇总了Python中ttk.Treeview.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Treeview.configure方法的具体用法?Python Treeview.configure怎么用?Python Treeview.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Treeview
的用法示例。
在下文中一共展示了Treeview.configure方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
def show(frame, iterator):
"""Выводит на экран выборку, заданную в iterator"""
scrollbar = Scrollbar(frame)
tree = Treeview(frame, selectmode='none', padding=3,
style='Custom.Treeview', height=REPORT_HEIGHT,
yscrollcommand=scrollbar.set)
tree.pack(side=LEFT, fill=BOTH, expand=YES)
scrollbar.config(command=tree.yview)
scrollbar.pack(side=LEFT, fill=Y)
tree.tag_configure('1', font=('Verdana', FONT_SIZE_REPORT))
tree.tag_configure('2', font=('Verdana', FONT_SIZE_REPORT),
background='#f5f5ff')
Style().configure('Custom.Treeview', rowheight=FONT_SIZE_REPORT*2)
columns = ['#' + str(x + 1) for x in range(8)]
tree.configure(columns=columns)
for q in range(len(header)):
tree.heading('#%d' % (q + 1), text=header[q], anchor='w')
tree.column('#%d' % (q + 1), width=REPORT_SCALE * col_width[q + 1],
anchor='w')
tree.heading('#0', text='', anchor='w')
tree.column('#0', width=0, anchor='w', minwidth=0)
flag = True
summ = 0
for item in iterator:
value = item.quantity * item.price * (100 - item.discount) / 100
summ += value
col = []
col.append(add_s(item.check.id))
col.append(add_s(item.goods.cathegory.name))
col.append(add_s(item.goods.name))
col.append(add_s(item.quantity))
col.append(add_s(item.discount) +'%' if item.discount else ' -- ')
col.append(add_s(u'%6.2f грн.' % value))
col.append(add_s(item.check.date_time.strftime('%d.%m.%Y')))
col.append(add_s(item.check.date_time.time())[:8])
flag = not flag
if flag:
tree.insert('', 'end', text='', values=col, tag='2')
else:
tree.insert('', 'end', text='', values=col, tag='1')
return summ
示例2: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
global info, tree
#VARIABLES
info = IntVar()
#WIDGETS
#========================= HEADER ===========================
self.header = Label(self, text="ADMINISTRADOR DE DOCUMENTOS", font="bold")
self.header.pack(pady=20, side=TOP)
#========================= WRAPPER 1 ===========================
self.wrapper = Frame (self)
self.wrapper.pack(side=LEFT, fill=Y)
#======================== DOCUMENTOS DE ========================
self.f0 = Frame(self.wrapper)
self.f0.pack(pady=5,fill=X)#------------------------------------
self.lf1 = LabelFrame(self.f0, text="Documentos de")#---------->
self.f1 = Frame(self.lf1)
self.f1.pack(pady=5, side=LEFT)
self.pR1 = Radiobutton(self.f1, text="Propietario", variable=info, value=1, command=select)
self.pR1.grid(row=0, column=0, sticky=W)
self.aR2 = Radiobutton (self.f1, text="Arrendatario", variable=info, value=2, command=select)
self.aR2.grid(row=1, column=0, sticky=W)
self.tR3 = Radiobutton (self.f1, text="Tercero", variable=info, value=3, command=select)
self.tR3.grid(row=2, column=0, sticky=W)
self.lf1.pack(side=LEFT)#<--------------------------------------
#====================== FECHAS DE BÚSQUEDA =====================
self.lf2 = LabelFrame(self.f0, text="Fechas de búsqueda")#------>
self.f2 = Frame(self.lf2)
self.f2.pack(pady=5)#---------------------------
self.deL = Label(self.f2, text='De:')
self.deL.pack(side=LEFT)
self.deCbx = Combobox(self.f2, width=32)
self.deCbx.set('')
self.deCbx.pack(side=LEFT)
self.f3 = Frame(self.lf2)
self.f3.pack(pady=5)#---------------------------
self.hastaL = Label(self.f3, text='Hasta:')
self.hastaL.pack(side=LEFT)
self.hastaCbx = Combobox(self.f3, width=30)
self.hastaCbx.set('')
self.hastaCbx.pack(side=LEFT)
self.lf2.pack(side=LEFT, fill=X)#<---------------------------
#========================= WRAPPER 2 ===========================
self.wrapper2 = Frame (self.wrapper)
self.wrapper2.pack(pady=5,fill=X)
#========================= BENEFICIARIO ========================
self.box1 = Frame(self.wrapper2)
self.box1.pack(side=LEFT)
#---------------------------------------------------------------
self.f4 = Frame(self.box1)
self.f4.pack()
self.l1 = Label(self.f4, text="Beneficiario")
self.l1.pack()
tree = Treeview(self.f4, height=7, show="headings", columns=('col1','col2'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=100, anchor='center')
tree.column('col2', width=180, anchor='center')
tree.heading('col1', text='CC')
tree.heading('col2', text='Nombres')
self.scroll = Scrollbar(self.f4,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=self.scroll.set)
self.f5 = Frame(self.box1)#----------------------------------
self.f5.pack()
self.lf3 = LabelFrame(self.f5, text="Factura Propietario")#---->
self.e1 = Entry(self.lf3, width=12).pack(side=LEFT)
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
global docID, nombre, refbanco, tree, busqueda, info, delete
global e3
lupa = PhotoImage(file='img/lupa.png')
docID = StringVar()
nombre = StringVar()
refbanco = StringVar()
busqueda = StringVar()
info = IntVar()
#WIDGETS
#=========================== HEADER ============================
l0 = Label(self, text="BENEFICIARIOS", font="bold")
l0.pack(pady=20, side=TOP)
#=========================== WRAPPER ===========================
wrapper = Frame (self)
wrapper.pack(side=TOP, fill=Y)
#wrapper.pack(side=LEFT, fill=Y) #UBICA EL FORM A LA IZQ
f1 = Frame(wrapper)
f1.pack(pady=5, fill=X)#-----------------------------------
l1 = Label (f1, text="CC/Nit: ")
l1.pack(side=LEFT)
e1 = Entry (f1, textvariable=docID, width=20)
e1.pack(side=LEFT)
e1.bind("<KeyRelease>", caps)
e1.focus_set()
f2 = Frame(wrapper)
f2.pack(pady=5, fill=X)#-----------------------------------
l2 = Label (f2, text="Nombre: ")
l2.pack(side=LEFT)
e2 = Entry (f2, textvariable=nombre, width=60)
e2.pack(side=LEFT, fill=X, expand=1)
e2.bind("<KeyRelease>", caps)
f3 = Frame(wrapper)
f3.pack(pady=5, fill=X)#-----------------------------------
l3 = Label (f3, text="Referencia Bancaria: ")
l3.pack(side=LEFT)
e3 = Entry (f3, textvariable=refbanco, width=60)
e3.pack(side=LEFT, fill=X, expand=1)
e3.bind("<KeyRelease>", caps)
f4 = Frame(wrapper)
f4.pack(pady=5, fill=X)#-----------------------------------
b1 = Button (f4, text="Cargar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cargar)
b1.pack(side=RIGHT)
b2 = Button (f4, text="Agregar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=agregar)
b2.pack(side=RIGHT)
#========================== TREEVIEW ===========================
f5 = Frame(wrapper)
f5.pack(pady=5, fill=X)#-----------------------------------
tree = Treeview(f5, show="headings", columns=('col1','col2'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=0, anchor='center')
tree.column('col2', width=150, anchor='w')
tree.heading('col1', text='CC/Nit')
tree.heading('col2', text='Nombre Completo')
scroll = Scrollbar(f5,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=scroll.set)
f6 = Frame(wrapper)
f6.pack(pady=5, fill=X)#-----------------------------------
delete = Button (f6, text="Eliminar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=borrar)
delete.pack(side=RIGHT)
e4 = Entry(f6, textvariable=busqueda)
e4.pack(side=LEFT)
e4.bind("<KeyRelease>", caps)
b4 = Button(f6, text='BUSCAR', image=lupa, command=buscar)
b4.image = lupa
b4.pack(side=LEFT)
R1 = Radiobutton(f6, text="CC/nit", variable=info, value=1)
R1.pack(side=LEFT)
R2 = Radiobutton (f6, text="Nombre", variable=info, value=2)
R2.pack(side=LEFT)
info.set(1)
示例4: ReciboCaja
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
#.........这里部分代码省略.........
self.f2 = Frame(self.tab1)
self.f2.pack(pady=5,fill=X)#------------------------------------
self.nombre = Label(self.f2, text='Nombre:')
self.nombre.pack(side=LEFT)
self.nombrE = Entry(self.f2, width=5, state=DISABLED)
self.nombrE.pack(side=LEFT, fill=X, expand=1)
self.f3 = Frame(self.tab1)
self.f3.pack(pady=5,fill=X)#------------------------------------
self.inmueble = Label(self.f3, text='Inmueble:')
self.inmueble.pack(side=LEFT)
self.inmuebleCbx = Combobox(self.f3, values=NONE, width=10)
self.inmuebleCbx.set('')
self.inmuebleCbx.pack(side=LEFT, fill=X, expand=1)
self.b2 = Button(self.f3, text='Agregar', image=lupa)
self.b2.image=lupa
self.b2.pack(side=LEFT)
self.f4 = Frame(self.tab1)
self.f4.pack(pady=5,fill=X)#------------------------------------
self.fpago = Label(self.f4, text='Forma de Pago:')
self.fpago.pack(side=LEFT)
self.fpagoCbx = Combobox(self.f4, values=NONE, width=10)
self.fpagoCbx.set('')
self.fpagoCbx.pack(side=LEFT)
self.b3 = Button(self.f4, text='Crear novedad', state=DISABLED)
self.b3.pack(side=LEFT)
#========================== TREEVIEW ===========================
self.f5 = Frame(self.tab1)
self.f5.pack(pady=5,fill=X)#------------------------------------
self.tree = Treeview(self.f5, height=4, show="headings", columns=('col1','col2','col3'))
self.tree.pack(side=LEFT, fill=X, expand=1)
self.tree.column('col1', width=20, anchor='center')
self.tree.column('col2', width=200, anchor='center')
self.tree.column('col3', width=10, anchor='center')
self.tree.heading('col1', text='CC')
self.tree.heading('col2', text='Descripción')
self.tree.heading('col3', text='Valor')
self.scroll = Scrollbar(self.f3,orient=VERTICAL,command=self.tree.yview)
self.tree.configure(yscrollcommand=self.scroll.set)
self.f6 = Frame(self.tab1)
self.f6.pack(pady=5,fill=X)#--------------------
self.notesL = Label(self.f6, text='Observaciones:')
self.notesL.pack(side=LEFT)
self.f7 = Frame(self.tab1)
self.f7.pack(pady=5,fill=X)#-------------------
self.notesT = Text(self.f7, height=5)
self.notesT.pack(fill=X, side=LEFT, expand=1)
#-----------------------> TAB 2
self.tab2 = Frame (self.nb)
self.tab2.pack()
#-----------------------> TAB 3
self.tab3 = Frame (self.nb)
self.tab3.pack()
#---------------------------------------------------------------
self.nb.add (self.tab1, text="Datos Generales")
self.nb.add(self.tab2, text="Referencia de Pago", state=DISABLED)
self.nb.add(self.tab3, text="Referencias Bancarias", state=DISABLED)
self.nb.pack()
#---------------------------------------------------------------
self.fBtn = Frame(self.wrapper)
self.fBtn.pack()#-------------------------------
self.queryB = Button(self.fBtn, text='Consultar')
self.queryB.pack(side=RIGHT)
self.deleteB = Button(self.fBtn, text='Borrar')
self.deleteB.pack(side=RIGHT)
self.updateB = Button(self.fBtn, text='Actualizar')
self.updateB.pack(side=RIGHT)
self.addB = Button(self.fBtn, text='Agregar')
self.addB.pack(side=RIGHT)
#========================= ASIDE ===========================
"""
示例5: CommSearch
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
class CommSearch(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.entries_found = []
self.parent.title("Search your command cards")
self.style = Style()
self.style.theme_use("default")
self.pack()
self.input_title = Label(self, text="Enter your command below")
self.input_title.grid(row=0, columnspan=2)
self.input_box = Entry(self, width=90)
self.input_box.grid(row=1, column=0)
self.input_box.focus()
self.input_box.bind("<Key>", self.onUpdateSearch)
self.search_btn = Button(self, text="Search", command=self.onSearch)
self.search_btn.grid(row=1, column=1)
self.output_box = Treeview(self, columns=("Example"))
ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview)
xsb = Scrollbar(self, orient='horizontal', command=self.output_box.xview)
self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set)
self.output_box.heading('Example', text='Example', anchor='w')
self.output_box.column("#0",minwidth=0,width=0, stretch=NO)
self.output_box.column("Example",minwidth=0,width=785)
self.output_box.bind("<Button-1>", self.OnEntryClick)
self.output_box.grid(row=3, columnspan=2)
self.selected_box = Text(self, width=110, height=19)
self.selected_box.grid(row=4, columnspan=2)
self.gotoadd_btn = Button(self, text="Go to Add", command=self.onGoToAdd)
self.gotoadd_btn.grid(row=5)
def OnEntryClick(self, event):
try:
item = self.output_box.selection()[0]
except IndexError:
pass
entry_title = self.output_box.item(item,"value")
for item in self.entries_found:
if str(entry_title) == str("('" + item.title.strip('\n') + "',)"):
self.selected_box.delete(0.1, END)
self.selected_box.insert(END, item.text + '\n')
def onUpdateSearch(self, key):
# Somehow calling self.onSearch() does not register last key
# And we need to correct "special chars"
global entries, entries_map
text_entries = ""
for item in self.output_box.get_children():
self.output_box.delete(item)
# ...like, for instance, deleting last character
if key.char == '\b':
search_terms = str(self.input_box.get()[:-1])
else:
search_terms = str(self.input_box.get() + key.char)
self.entries_found = []
self.entries_found = data.Search(search_terms,entries,entries_map)
for item in range(len(self.entries_found)):
aux = self.output_box.insert('', 'end', '', value=[self.entries_found[item].title.split('\n')[0]])
def onSearch(self):
global entries, entries_map
text_entries = ""
for item in self.output_box.get_children():
self.output_box.delete(item)
search_terms = str(self.input_box.get())
for item in data.Search(search_terms,entries,entries_map):
self.output_box.insert('', 'end', '', value=[self.entries_found[item].title.split('\n')[0]])
def onGoToAdd(self):
newroot = Tk()
newcomm = CommAdd(newroot)
newroot.geometry("800x600+0+0")
newroot.mainloop()
示例6: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
class MainWindowUI:
# | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
# +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
# | menu bar |
# +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
# | | search bar |
# | | search entry | button|
# | +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
# | | | |
# | | | |
# | | | |
# | treeview | | |
# | | text area 1 | text area 2 |
# | | | |
# | | | |
# | | | |
# | | | |
# +-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
# | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
# Rows
fileTreeRow = filePathLabelsRow = 0
searchTextRow = 1
uniScrollbarRow = lineNumbersRow = textAreasRow = 2
horizontalScrollbarRow = 3
# Columns
fileTreeCol = 0
fileTreeScrollbarCol = 1
leftLineNumbersCol = leftFilePathLabelsCol = 2 # should span at least two columns
leftTextAreaCol = leftHorizontalScrollbarCol = 3
uniScrollbarCol = 4
rightLineNumbersCol = rightFilePathLabelsCol = 5 # should span at least two columns
rightTextAreaCol = rightHorizontalScrollbarCol = 6
# Colors
whiteColor = '#ffffff'
redColor = '#ffc4c4'
darkredColor = '#ff8282'
grayColor = '#dddddd'
lightGrayColor = '#eeeeee'
greenColor = '#c9fcd6'
darkgreenColor = '#50c96e'
yellowColor = '#f0f58c'
darkYellowColor = '#ffff00'
def __init__(self, window):
self.main_window = window
self.main_window.grid_rowconfigure(self.filePathLabelsRow, weight=0)
self.main_window.grid_rowconfigure(self.searchTextRow, weight=0)
self.main_window.grid_rowconfigure(self.textAreasRow, weight=1)
self.main_window.grid_columnconfigure(self.fileTreeCol, weight=0)
self.main_window.grid_columnconfigure(self.fileTreeScrollbarCol, weight=0)
self.main_window.grid_columnconfigure(self.leftLineNumbersCol, weight=0)
self.main_window.grid_columnconfigure(self.leftTextAreaCol, weight=1)
self.main_window.grid_columnconfigure(self.uniScrollbarCol, weight=0)
self.main_window.grid_columnconfigure(self.rightLineNumbersCol, weight=0)
self.main_window.grid_columnconfigure(self.rightTextAreaCol, weight=1)
self.menubar = Menu(self.main_window)
self.menus = {}
self.text_area_font = 'TkFixedFont'
# Center window and set its size
def center_window(self):
sw = self.main_window.winfo_screenwidth()
sh = self.main_window.winfo_screenheight()
w = 0.7 * sw
h = 0.7 * sh
x = (sw - w)/2
y = (sh - h)/2
self.main_window.geometry('%dx%d+%d+%d' % (w, h, x, y))
self.main_window.minsize(int(0.3 * sw), int(0.3 * sh))
# Menu bar
def add_menu(self, menuName, commandList):
self.menus[menuName] = Menu(self.menubar,tearoff=0)
for c in commandList:
if 'separator' in c: self.menus[menuName].add_separator()
else: self.menus[menuName].add_command(label=c['name'], command=c['command'], accelerator=c['accelerator'] if 'accelerator' in c else '')
self.menubar.add_cascade(label=menuName, menu=self.menus[menuName])
self.main_window.config(menu=self.menubar)
# Labels
def create_file_path_labels(self):
self.leftFileLabel = Label(self.main_window, anchor='center', width=1000, background=self.lightGrayColor)
self.leftFileLabel.grid(row=self.filePathLabelsRow, column=self.leftFilePathLabelsCol, columnspan=2)
self.rightFileLabel = Label(self.main_window, anchor='center', width=1000, background=self.lightGrayColor)
self.rightFileLabel.grid(row=self.filePathLabelsRow, column=self.rightFilePathLabelsCol, columnspan=2)
# Search text entnry
def create_search_text_entry(self, searchButtonCallback):
self.searchTextDialog = SearchTextDialog(self.main_window, [self.leftFileTextArea, self.rightFileTextArea], searchButtonCallback)
self.searchTextDialog.grid(row=self.searchTextRow, column=self.leftFilePathLabelsCol, columnspan=5, sticky=EW)
self.searchTextDialog.grid_remove()
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
global codigo, descripcion, tree, busqueda, info
global e3
lupa = PhotoImage(file='img/lupa.png')
codigo = StringVar()
descripcion = StringVar()
busqueda = StringVar()
info = IntVar()
#WIDGETS
#=========================== HEADER ============================
self.titleL = Label(self, text="CUENTAS CONTABLES", font="bold")
self.titleL.pack(pady=20, side=TOP)
#=========================== WRAPPER ===========================
self.wrapper = Frame (self)
self.wrapper.pack(side=TOP, fill=Y)
#self.wrapper.pack(side=LEFT, fill=Y) #UBICA EL FORM A LA IZQ
self.f0 = Frame(self.wrapper)
self.f0.pack(pady=5, fill=X)#-----------------------------------
l1 = Label (self.f0, text="Código:")
l1.pack(side=LEFT)
e1 = Entry (self.f0, textvariable=codigo, width=20)
e1.pack(side=LEFT)
e1.bind("<KeyRelease>", caps)
e1.focus_set()
self.f2 = Frame(self.wrapper)
self.f2.pack(pady=5, fill=X)#-----------------------------------
l2 = Label (self.f2, text="Descripción: ")
l2.pack(side=LEFT)
e2 = Entry (self.f2, textvariable=descripcion, width=60)
e2.pack(side=LEFT, fill=X, expand=1)
e2.bind("<KeyRelease>", caps)
self.f3 = Frame(self.wrapper)
self.f3.pack(pady=5, fill=X)#-----------------------------------
b1 = Button (self.f3, text="Cargar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cargar)
b1.pack(side=RIGHT)
b2 = Button (self.f3, text="Agregar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=agregar)
b2.pack(side=RIGHT)
#========================== TREEVIEW ===========================
self.f4 = Frame(self.wrapper)
self.f4.pack(pady=5, fill=X)#-----------------------------------
tree = Treeview(self.f4, show="headings", columns=('col1','col2'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=0, anchor='center')
tree.column('col2', width=150, anchor='w')
tree.heading('col1', text='Código')
tree.heading('col2', text='Descripción')
self.scroll = Scrollbar(self.f4,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=self.scroll.set)
self.f5 = Frame(self.wrapper)
self.f5.pack(pady=5, fill=X)#-----------------------------------
self.delete = Button (self.f5, text="Eliminar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=borrar)
self.delete.pack(side=RIGHT)
e3 = Entry(self.f5, textvariable=busqueda)
e3.pack(side=LEFT)
e3.bind("<KeyRelease>", caps)
b3 = Button(self.f5, text='BUSCAR', image=lupa, command=buscar)
b3.image = lupa
b3.pack(side=LEFT)
R1 = Radiobutton(self.f5, text="Código", variable=info, value=1)
R1.pack(side=LEFT)
R2 = Radiobutton (self.f5, text="Desc", variable=info, value=2)
R2.pack(side=LEFT)
info.set(1)
示例8: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
#.........这里部分代码省略.........
self.f2.pack(pady=5, fill=X)#-------------------------------
l5 = Label(self.f2, text='Código:')
l5.pack(side=LEFT)
e4 = Entry(self.f2, textvariable=cod)
e4.pack(side=LEFT)
e4.bind('<Return>', buscarC)
b2 = Button(self.f2, text='Buscar:', image=lupa, command=topCtasContables)
b2.pack(side=LEFT)
self.f3 = Frame(self.lf2)
self.f3.pack(pady=5, fill=X)#-------------------------------
l6 = Label(self.f3, text='Descripción:')
l6.pack(side=LEFT)
e5 = Entry(self.f3, textvariable=desc, state=DISABLED)
e5.pack(side=LEFT, fill=X, expand=1)
l7 = Label(self.f3, text='Valor:')
l7.pack(side=LEFT)
e6 = Entry(self.f3, width=15, textvariable=valor)
e6.pack(side=LEFT)
b3 = Button(self.f3, text='Agregar:', command=agregar)
b3.pack(side=LEFT)
#-------------------------- TREEVIEW ---------------------------
self.f4 = Frame(self.wrapper)
self.f4.pack(pady=5,fill=X)
tree = Treeview(self.f4, height=4, show="headings", columns=('col1','col2','col3'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=20, anchor='center')
tree.column('col2', width=200, anchor='center')
tree.column('col3', width=10, anchor='center')
tree.heading('col1', text='Código')
tree.heading('col2', text='Concepto')
tree.heading('col3', text='Valor')
scroll = Scrollbar(self.f4,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=scroll.set)
tree.bind("<Delete>", borrar)
#-------------------------- RESULTADOS ---------------------------
self.f5 = Frame(self.wrapper)
self.f5.pack(pady=5,fill=X)#-------------------
l8 = Label(self.f5, textvariable=resultado, fg="red", bg="white", anchor='e', font="bold, 22", relief= SUNKEN)
l8.pack(fill=X, side=RIGHT, expand=1)
#-------------------------- FOOTER ---------------------------
self.fBtn = Frame(self.wrapper)
self.fBtn.pack()#-------------------------------
clean = Button(self.fBtn, text='Cancelar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=limpiar)
clean.pack(side=RIGHT)
add = Button(self.fBtn, text='Grabar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=grabar)
add.pack(side=RIGHT)
#========================= ASIDE ===========================
self.aside = Frame(self)
self.aside.pack(side=TOP, fill=BOTH)
self.wrap1 = Frame(self.aside)
self.wrap1.pack()
self.viewer = Label(self.wrap1, text="LISTA DE GASTOS")
self.viewer.pack()
scroll = Scrollbar(self.wrap1, orient=VERTICAL)
scroll.pack(side=RIGHT, fill=Y)
lb = Listbox(self.wrap1, yscrollcommand=scroll.set, height=20, width=30)
scroll.config (command=lb.yview)
lb.pack(fill=BOTH)
self.wrap2 = Frame(self.aside)
self.wrap2.pack()
load = Button(self.wrap2, text='Cargar lista', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cargar_lista)
load.pack(fill=X)
delete = Button(self.wrap2, text='Borrar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=None)
delete.pack(fill=X)
edit = Button(self.wrap2, text='Modificar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=None)
edit.pack(fill=X)
buscador = Label(self.wrap2, text="Buscar por Número:")
buscador.pack()
E = Entry(self.wrap2, textvariable=busqueda, width=24)
E.pack()
E.bind("<KeyRelease>", caps)
示例9: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
#.........这里部分代码省略.........
l.pack(side=LEFT)
e9 = Entry(f3, textvariable=iva, state=DISABLED, width=12)
e9.pack(side=LEFT,fill=X)
l = Label(f3, text='Total ')
l.pack(side=LEFT)
e10 = Entry(f3, textvariable=total, state=DISABLED, width=12)
e10.pack(side=LEFT,fill=X)
f4 = Frame(wrap)
f4.pack(pady=5,fill=X)#---------------------------
#========================= FACTURACIÓN =========================
self.lf1 = LabelFrame(self, text="Periodo a facturar")
self.lf1.pack(anchor=W,pady=5,fill=X)#-------------------------
self.f2 = Frame(self.lf1)
self.f2.pack(pady=5,fill=X)#---------------------------
self.mesiniL = Label(self.f2, text='Mes inicial:')
self.mesiniL.pack(padx=5,side=LEFT)
CbxVlr = Combobox(self.f2, textvariable=mes1, values=meses, width=10, state=DISABLED)
CbxVlr.set(mes)
CbxVlr.pack(side=LEFT)
self.emptyL = Label(self.f2)###VACIO###
self.emptyL.pack(padx=5, side=LEFT)
self.yeariniL = Label(self.f2, text='Año:')
self.yeariniL.pack(side=LEFT)
self.yeariniE = Entry(self.f2, textvariable=fechapago, width=8, state=DISABLED)
fechapago.set(anio)
self.yeariniE.pack(side=LEFT)
self.mesfinL = Label(self.f2, text='Mes final:')
self.mesfinL.pack(padx=5,side=LEFT)
self.mesfinCbx = Combobox(self.f2, textvariable=mes2, values=meses, width=10)
self.mesfinCbx.set(mes)
self.mesfinCbx.pack(side=LEFT)
self.emptyL = Label(self.f2)###VACIO###
self.emptyL.pack(padx=5, side=LEFT)
self.yearfinL = Label(self.f2, text='Año:')
self.yearfinL.pack(side=LEFT)
self.yearfinE = Entry(self.f2, textvariable=fechapago, width=8)
fechapago.set(anio)
self.yearfinE.pack(side=LEFT)
self.emptyL = Label(self.f2)###VACIO###
self.emptyL.pack(padx=5, side=LEFT)
pdfB = Button(self.f2, text="Facturar", command=agregar, state=DISABLED)
pdfB.pack(side=LEFT)
#========================== TREEVIEW ===========================
self.f3 = Frame(self)
self.f3.pack(pady=5,fill=X)#------------------------------------
tree = Treeview(self.f3, height=4, show="headings", columns=('col1','col2'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=250, anchor='center')
tree.column('col2', width=5, anchor='center')
tree.heading('col1', text='Descripción')
tree.heading('col2', text='Valor')
scroll = Scrollbar(self.f3,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=scroll.set)
tree.bind("<Delete>", borrar)
#======================== OBSERVACIONES ========================
self.f4 = Frame(self)
self.f4.pack(pady=5,fill=X)#--------------------
self.notesL = Label(self.f4, text='Observaciones:')
self.notesL.pack(side=LEFT)
self.f5 = Frame(self)
self.f5.pack(pady=5,fill=X)#-------------------
observaciones = Text(self.f5, height=5)
observaciones.pack(fill=X, side=LEFT, expand=1)
#=========================== BOTONES ===========================
footer = Frame(self)
footer.pack()#-------------------------------
clean = Button(footer, text='Cancelar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cancelar)
clean.pack(side=RIGHT)
add = Button(footer, text='Grabar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=grabar, state=DISABLED)
add.pack(side=RIGHT)
示例10: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
global codigo, ctacontable, nombre, desc, tree
lupa = PhotoImage(file='img/lupa.png')
codigo = StringVar()
ctacontable = StringVar()
nombre = StringVar()
desc = StringVar()
#WIDGETS
#=========================== HEADER ============================
self.titleL = Label(self, text="CONCEPTO DE GASTOS", font="bold")
self.titleL.pack(pady=20, side=TOP)
#=========================== WRAPPER ===========================
self.wrapper = Frame (self)
self.wrapper.pack(side=TOP, fill=Y)
self.f0 = Frame(self.wrapper)
self.f0.pack(pady=5, fill=X)#-----------------------------------
l1 = Label (self.f0, text="Código:")
l1.pack(side=LEFT)
e1 = Entry (self.f0, textvariable=codigo, width=60)
e1.pack(side=LEFT)
e1.bind("<KeyRelease>", caps)
self.f2 = Frame(self.wrapper)
self.f2.pack(pady=5, fill=X)#-----------------------------------
l2 = Label (self.f2, text="Cuenta Contable: ")
l2.pack(side=LEFT)
e2 = Entry (self.f2, textvariable=ctacontable, width=60)
e2.pack(side=LEFT, fill=X, expand=1)
b0 = Button (self.f2, text="Buscar", image=lupa, command=buscar)
b0.image=lupa
b0.pack(side=LEFT)
self.f3 = Frame(self.wrapper)
self.f3.pack(pady=5, fill=X)#-----------------------------------
self.nombre = Label (self.f3, text="Nombre: ")
self.nombre.pack(side=LEFT)
self.nombreE = Entry (self.f3, textvariable=nombre, state=DISABLED)
self.nombreE.pack(side=LEFT, fill=X, expand=1)
self.f4 = Frame(self.wrapper)
self.f4.pack(pady=5, fill=X)#-----------------------------------
self.descL = Label (self.f4, text="Descripción: ")
self.descL.pack(side=LEFT)
self.descE = Entry (self.f4, textvariable=desc)
self.descE.pack(side=LEFT, fill=X, expand=1)
self.descE.bind("<KeyRelease>", caps)
self.f5 = Frame(self.wrapper)
self.f5.pack(pady=5, fill=X)#-----------------------------------
b1 = Button (self.f5, text="Cargar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cargar)
b1.pack(side=RIGHT)
b2 = Button (self.f5, text="Agregar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=agregar)
b2.pack(side=RIGHT)
self.f6 = Frame(self.wrapper)
self.f6.pack(pady=5, fill=X)#-----------------------------------
tree = Treeview(self.f6, show="headings", columns=('col1','col2', 'col3', 'col4'))
tree.pack(side=LEFT, fill=X, expand=1)
tree.column('col1', width=2, anchor='center')
tree.column('col2', width=150, anchor='center')
tree.column('col3', width=10, anchor='center')
tree.column('col4', width=150, anchor='center')
tree.heading('col1', text='Código')
tree.heading('col2', text='Descripción')
tree.heading('col3', text='Cta Contable')
tree.heading('col4', text='Nombre')
self.scroll = Scrollbar(self.f6,orient=VERTICAL,command=tree.yview)
tree.configure(yscrollcommand=self.scroll.set)
self.f7 = Frame(self.wrapper)
self.f7.pack(pady=5, fill=X)#-----------------------------------
self.delete = Button (self.f7, text="Eliminar", bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=borrar)
self.delete.pack(side=RIGHT)
示例11: Statistics
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import configure [as 别名]
#.........这里部分代码省略.........
self.orderby = orderby
Button(paramframe,text="Вывести",command=(lambda: self.getStatistics())).grid(row=6,column=0,columnspan=2)
Label(paramframe,text="Итого: ",height=20).grid(row=7,column=0)
self.summarylbl = Label(paramframe,text='0.0',height=20)
self.summarylbl.grid(row=7,column=1)
#end ------------------------------------------------------------------------------------------------------------------
#table -------------------------------------------------------------------------------------------------------------
self.viewframe = Frame(self,relief=GROOVE,width=200,bd=1)
self.viewframe.pack(side=RIGHT,fill=BOTH,expand=YES)
#end ------------------------------------------------------------------------------------------------------------------
self.geometry("%dx%d+%d+%d" % (1000,500,225,125))
self.wait_window(self)
def getStatistics(self):
when = self.when.current()
dateRange = ''
if when == 0:
#today
dateRange = datetime.date.today()
elif when == 1:
#3 days
dateRange = datetime.date.today() - datetime.timedelta(days=3)
elif when == 2:
#5 days
dateRange = datetime.date.today() - datetime.timedelta(days=5)
elif when == 3:
#1 week
dateRange = datetime.date.today() - datetime.timedelta(weeks=1)
elif when == 4:
#3 weeks
dateRange = datetime.date.today() - datetime.timedelta(weeks=3)
elif when == 5:
#1 month
dateRange = datetime.date.today() - datetime.timedelta(weeks=4)
elif when == 6:
#all
dateRange = '2012-01-01'
orderby = self.orderby.current()
if orderby == 0:
#date
orderby = 4
elif orderby == 1:
#summ
orderby = 2
elif orderby == 2:
#c.title
orderby = 6
global payments
payments.getPayments(1,str(dateRange))
if hasattr(self, 'tree'):
self.tree.destroy()
self.tree = Treeview(self.viewframe,selectmode="extended",columns=('summ', 'comment', 'date','mul','category_title'))
self.tree.heading('#0',text='№')
self.tree.column('#0',width=15,anchor='center')
self.tree.column('summ', width=60, anchor='center')
self.tree.column('comment', anchor='center')
self.tree.column('date', width=60, anchor='center')
self.tree.column('mul', width=7, anchor='center')
self.tree.column('category_title', anchor='center')
self.tree.heading('summ', text='Сумма')
self.tree.heading('comment', text='Комметарий')
self.tree.heading('date', text='Дата')
self.tree.heading('mul', text='Количество')
self.tree.heading('category_title', text='Категория')
i=1
summary = 0.0
for row in payments.paymetsList:
self.tree.insert('', i,str(i), text=str(i))
self.tree.set(str(i),'summ',row['summ'])
self.tree.set(str(i),'comment',row['comment'])
self.tree.set(str(i),'date',row['date'])
self.tree.set(str(i),'mul',row['mul'])
self.tree.set(str(i),'category_title',row['category_title'])
i+=1
summary+=row['summ']*row['mul']
self.summarylbl.config(text=str(summary))
self.tree.pack(side=TOP, fill=BOTH, expand=YES)
s = Scrollbar(self.tree, orient=VERTICAL, command=self.tree.yview)
self.tree.configure(yscrollcommand=s.set)
s.pack(side=RIGHT,fill=Y)