本文整理汇总了Python中ttk.Treeview.pack方法的典型用法代码示例。如果您正苦于以下问题:Python Treeview.pack方法的具体用法?Python Treeview.pack怎么用?Python Treeview.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Treeview
的用法示例。
在下文中一共展示了Treeview.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
def __init__(self, parent, process, x, y):
Toplevel.__init__(self, parent)
self.wm_overrideredirect(True)
self.wm_geometry("+%d+%d" % (x+25,y+20))
label = Label(self, text="", justify='left',
background='white', relief='solid', borderwidth=1,
font=("times", "12", "normal"))
label.pack(ipadx=20)
tree = Treeview(label)
tree["columns"] = ("value")
tree.column("#0", minwidth=0, width=100)
tree.column("#1", minwidth=0, width=100)
tree.heading("#0", text="Name")
tree.heading("#1", text="Value")
for A, state in process.state.items():
if isinstance(A, Algorithm):
tree.insert("", 0, iid=A, text=str(A), values=("",))
for key, val in state.items():
tree.insert(A, 0, text=key, values=(val,))
for key, val in process.state.items():
if not isinstance(key, Algorithm):
tree.insert("", 0, text=key, values=(val,))
tree.insert("", 0, text="UID", values=(process.UID,))
tree.pack()
示例2: show
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [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
示例3: FilamentReport
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
class FilamentReport(Toplevel):
def __init__(self, app, printer, settings, logger, *arg):
self.app = app
self.printer = printer
self.settings = settings
self.logger = logger
layers = self.app.gcodeInfo.layerOrder
usage = self.app.gcodeInfo.filLayers
self.selection = None
Toplevel.__init__(self, app, *arg)
self.title("Layer by Layer Filament Usage")
self.protocol("WM_DELETE_WINDOW", self.doCancel)
f = Frame(self)
f.grid(row=1, column=1, rowspan=1, padx=10)
self.tree = Treeview(self, height=12, selectmode='browse')
self.sb = Scrollbar(self)
self.sb.config(command=self.tree.yview)
self.tree.config(yscrollcommand=self.sb.set)
ln = []
for l in layerinfo:
ln.append(l[0])
del ln[0]
self.tree.config(columns=ln)
for l in layerinfo:
self.tree.column(l[0], width=l[1], anchor=l[2])
self.tree.heading(l[0], text=l[3])
self.sb.pack(side=RIGHT, fill=Y)
self.tree.pack(side=LEFT, fill=BOTH, expand=1)
prev = 0.0
tl = layers[-1]
total = usage[tl]
for l in layers:
n = usage[l]
self.tree.insert('', 'end', text=l, values=("%7.3f" % (n-prev), "%9.3f" % n, "%9.3f" % (total-n)))
prev = n
def doCancel(self):
self.app.closeFilamentReport()
示例4: new_point
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
def new_point(self):
window = Toplevel(self)
tree = Treeview(window)
tree["columns"]=("1","2","3","4","5")
tree.column("1", width=50)
tree.column("2", width=50)
tree.column("3", width=50)
tree.column("4", width=50)
tree.column("5", width=50)
tree.heading("1", text="Played")
tree.heading("2", text="Won")
tree.heading("3", text="Lost")
tree.heading("4", text="Points")
rows = cur.execute('''SELECT * FROM point_table ORDER BY points DESC''')
c = 0
for row in rows:
tree.insert("" , c,text=str(row[1]), values=(row[2],row[3],row[4],row[5]))
c+=1
tree.pack()
示例5: ReciboCaja
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
class ReciboCaja(Frame):
def __init__(self, parent, controller):
Frame.__init__(self, parent)
lupa = PhotoImage(file='img/lupa.png')
#VARIABLES
tcontrato = ['Vivienda', 'Comercial']
aplica = StringVar()
#WIDGETS
#========================= HEADER ===========================
self.header = Label(self, text="RECIBO DE CAJA", font="bold")
self.header.pack(pady=20, side=TOP)
#========================== WRAPPER ==========================
self.wrapper = Frame (self)
self.wrapper.pack(side=TOP, fill=Y)
#self.wrapper.pack(side=LEFT, fill=Y)#Este ubica el forma a la IZA
#================ NOTEBOOK =============>
self.nb = Notebook(self.wrapper)
#-----------------------> TAB 1
self.tab1 = Frame (self.nb)
self.tab1.pack()
self.f0 = Frame(self.tab1)#-------------------------------------
self.f0.pack(pady=5,fill=X)
self.R1 = Radiobutton(self.f0, text="Arrendatario", variable=aplica, value='Arrendatario')
self.R1.pack(padx=20,side=LEFT)
self.R2 = Radiobutton (self.f0, text="Propietario", variable=aplica, value='Propietario')
self.R2.pack(padx=20,side=LEFT)
self.R3 = Radiobutton (self.f0, text="Tercero", variable=aplica, value='Tercero')
self.R3.pack(padx=20,side=LEFT)
self.f1 = Frame(self.tab1)#-------------------------------------
self.f1.pack(pady=5,fill=X)
self.cc = Label(self.f1, text='CC/Nit: ')
self.cc.pack(side=LEFT)
self.ccE = Entry(self.f1)
self.ccE.pack(side=LEFT)
self.b1 = Button(self.f1, text='Buscar', image=lupa)
self.b1.image=lupa
self.b1.pack(side=LEFT)
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')
#.........这里部分代码省略.........
示例6: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
class Display:
def __init__(self, controller):
self.controller = controller
self.currIndex = 0
# initialize the GUI
self.app = Tk()
self.app.title('Jack Magee\'s Pub')
self.tree = Treeview(self.app, height=30)
# name the tree columns, not sure if they have to be named numbers but that's how the example did it
self.tree["columns"]=("one", "two", "three", "four")
# set the column widths
self.tree.column("one", width=200)
self.tree.column("two", width=300)
self.tree.column("three", width=200)
self.tree.column("four", width=200)
# set the column headings
self.tree.heading("#0", text= "ID")
self.tree.heading("one", text="Name")
self.tree.heading("two", text="Order")
self.tree.heading("three", text="Price")
self.tree.heading("four", text="Respond (double-click)")
self.tree.pack()
# register handler for double-clicks
self.tree.bind("<Double-1>", self.OnDoubleClick)
def mainloop(self):
self.app.mainloop()
# this is like making tree entries buttons
def OnDoubleClick(self, event):
# get the pressed item
item = self.tree.selection()[0]
# get the item's text
response = self.tree.item(item,"text")
# this is the only response we are sending for now
if response == 'rdy':
# get the parent directory whose text is the customer id
parent = self.tree.parent(item)
customer_id = self.tree.item(parent,"text")
# remove it from the tree
self.tree.delete(parent)
# send the message to the customer
self.controller.send_msg(customer_id, response)
# add a new order to the tree
def takeOrder(self, customer_id, name, order, price):
# just a row identifier
thisRow = str(self.currIndex)
# insert the i.d. and name at the top level
self.tree.insert("", self.currIndex, thisRow, text=customer_id, values=(name, "", "", ""))
# insert the "button" for sending notification to clients
self.tree.insert(thisRow, 0, text='rdy', values=("", "", "", "Ready For Pick Up"))
# this is a hacky solution to get multiline orders to appear because treeviews will
# crop anything more than 1 line so I just make a new entry for every line
multiline_order = order.split('\n')
this_line = 1
for line in multiline_order[:-1]: # exclude the last end line
if this_line == 1: # the first line has the name of the order and it's price
self.tree.insert(thisRow, 1, text="order",values=("", order, price, ""))
else: # just keep printing the extra options, sides, and add ons
self.tree.insert(thisRow, this_line, text="order",values=("", line, "", ""))
this_line += 1
self.currIndex += 1
示例7: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [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 pack [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)
示例9: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
#INSTANCIAS
global cc, nombre, pago, ref, cod, desc, valor, resultado, total, tiempo, mes, anio, fechapago
#INSTANCIAS DE LOS WIDGETS
global e1, e2, e3, e4, e5, tree, l8, lb
cc = IntVar()
nombre = StringVar()
pago = StringVar()
ref = StringVar()
cod = StringVar()
desc = StringVar()
valor = DoubleVar()
tiempo = datetime.date.today()
anio = time.strftime("%Y")
mes = time.strftime("%B")
fechapago = StringVar()
total = 0.0
resultado = DoubleVar()
tbancos = ['Bancolombia', "Banco Bogotá", "Banco Agrario", "Banco Occidente"]
lupa = PhotoImage(file='img/lupa.png')
tbanktype = ['Corriente','Ahorro']
fpago = ['Efectivo','Transferencia']
#BUSQUEDA = ["Nombre","CC/Nit"]
busqueda = StringVar()
busqueda.trace("w", lambda name, index, mode: buscar())
dato = StringVar()
#WIDGETS
#========================= HEADER ==============================
self.titleL = Label(self, text="GASTOS", font="bold")
self.titleL.pack(pady=20, side=TOP)
#========================== WRAPPER ============================
self.wrapper = Frame (self)
self.wrapper.pack(side=LEFT, fill=Y)
#Esto centro el wrapper
#self.wrapper.pack(side=LEFT, fill=BOTH, expand=True)
#======================== BENEFICIARIO =======================
self.lf1 = LabelFrame(self.wrapper, text="Beneficiario")
self.lf1.pack(fill=X, ipady=5)
self.f0 = Frame(self.lf1)
self.f0.pack(pady=5, fill=X)#-----------------------------------
l1 = Label(self.f0, text='CC/Nit:')
l1.pack(side=LEFT)
e1 = Entry(self.f0, textvariable=cc)
e1.pack(side=LEFT)
e1.bind('<Return>', buscarB)
b0 = Button(self.f0, text='Buscar:', image=lupa, command=topBeneficiarios)
b0.pack(side=LEFT)
l2 = Label(self.f0, text='Nombre:')
l2.pack(side=LEFT)
e2 = Entry(self.f0, textvariable=nombre)
e2.pack(side=LEFT, fill=X, expand=1)
self.f1 = Frame(self.lf1)
self.f1.pack(pady=5, fill=X)#-----------------------------------
l3 = Label(self.f1, text='Forma de Pago:')
l3.pack(side=LEFT)
Cbx = Combobox(self.f1, textvariable=pago, values=fpago, width=15)
Cbx.set('Efectivo')
Cbx.pack(side=LEFT)
l4 = Label(self.f1, text='Ref. Bancaria:')
l4.pack(side=LEFT)
e3 = Entry(self.f1, textvariable=ref)
e3.pack(side=LEFT, fill=X, expand=1)
b1 = Button(self.f1, text='Buscar:', image=lupa)
b1.image=lupa
b1.pack(side=LEFT)
#======================== CONCEPTO ========================
self.lf2 = LabelFrame(self.wrapper, text="Concepto")
self.lf2.pack(fill=X, ipady=5)
self.f2 = Frame(self.lf2)
self.f2.pack(pady=5, fill=X)#-------------------------------
l5 = Label(self.f2, text='Código:')
#.........这里部分代码省略.........
示例10: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
class SDCard:
def __init__(self, root, prtr, settings, log):
self.app = root
self.printer = prtr
self.settings = settings
self.log = log
self.top = None
def isActive(self):
return self.top != None
def start(self):
self.app.sdchecking = True
self.printer.send_now("M21")
def sdCheckComplete(self, ready):
if not ready:
self.log.logMsg("Error initializing SD card")
else:
self.app.sdlisting = True
self.printer.send_now("M20")
def refresh(self):
self.top.destroy()
self.app.sdlisting = True
self.printer.send_now("M20")
def sdListComplete(self, sdlist):
top = self.top = Toplevel(self.app)
top.title("SD Card Control")
top.protocol('WM_DELETE_WINDOW', self.delTop)
f = Frame(top, height=150, width=150)
f.grid(row=1, column=1);
self.tree = Treeview(f, height=12, selectmode='browse')
self.tree.column("#0", minwidth=100)
self.tree.bind("<<TreeviewSelect>>", self.treeSelect)
self.sb = Scrollbar(f)
self.sb.config(command=self.tree.yview)
self.tree.config(yscrollcommand=self.sb.set)
self.sb.pack(side=RIGHT, fill=Y)
self.tree.pack(side=LEFT, fill=BOTH, expand=1)
SDroot = SDDir('')
for item in sdlist:
if item.startswith('/'):
cd = SDroot
l = item[1:].split('/')
for d in l[:-1]:
ncd = cd.getDir(d)
if ncd == None:
ncd = cd.addDir(d)
cd = ncd
cd.addFile(l[-1], fqn=item)
else:
SDroot.addFile(item)
SDroot.sortAll()
self.fileMap = {}
self.startFile = None
self.loadDir(SDroot, '')
bf = Frame(top, width=50)
bf.grid(column=3, row=1)
blf = LabelFrame(bf, text="Print from SD Card", width=48, height=40)
self.bPrint = Button(blf, text='Print', command=self.doPrint, width = 6)
self.bPrint.pack()
blf.pack(fill='x')
blf = LabelFrame(bf, text="Delete from SD Card", width=48, height=40)
self.bDelete = Button(blf, text="Delete", command=self.doDelete, width=6)
self.bDelete.pack()
blf.pack(fill='x')
blf = LabelFrame(bf, text="Upload to SD Card", width=48, height=180)
self.upDir = Label(blf, text="Dir:", justify=LEFT)
self.upDir.pack()
ef = Frame(blf)
l = Label(ef, text="File:", justify=LEFT)
l.pack(side=LEFT)
self.entry = Entry(ef, width=12)
self.entry.pack(side=LEFT)
fn = 'untitled.g'
if self.app.GCodeFile:
fn = os.path.basename(self.app.GCodeFile)
if len(fn) > 8:
fn = fn[0:8]
fn += ".g"
self.entry.delete(0, END)
self.entry.insert(0, fn)
ef.pack()
#.........这里部分代码省略.........
示例11: GUIBuscador
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
class GUIBuscador(Tk):
def __init__(self, master = None):
Tk.__init__(self, master)
self.gui(master)
self.dir = 'D:\Talker\Talker\Biblia'
self.direc = glob("%s\*" % self.dir)
def gui(self, master):
self.frm = Frame(master)
self.frm.pack(side = LEFT, expand = YES, fill = BOTH)
self.left_side(self.frm)
self.frm = Frame(master)
self.frm.pack(side = RIGHT, expand = YES, fill = BOTH)
self.right_side(self.frm)
def left_side(self, master):
self.nombre = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.NameVar)
self.nombre.pack(side = TOP, fill = X)
self.nombre.bind("<Key>", self.Enter)
self.texto = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.TextVar)
self.texto.pack(side = TOP, fill = X)
self.texto.bind("<Key>", self.Enter)
self.tag = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.TagsVar)
self.tag.pack(side = TOP, fill = X)
self.tag.bind("<Key>", self.Enter)
self.tree = Treeview(master)
self.tree.pack(side = LEFT, expand = YES, fill = BOTH)
self.tree.bind("<Double-1>", self.OnDoubleClick)
def right_side(self, master):
self.text = Text(master, bg = 'skyblue', bd = 5,
font = ('consolas', 12), fg = 'red')
self.text.pack(expand = YES, side = LEFT, fill = BOTH)
self.yscroller = Scrollbar(master, command = self.text.yview)
self.yscroller.pack(side = RIGHT, fill = Y)
self.text['yscrollcommand'] = self.yscroller
def OnDoubleClick(self, tree):
try:
item = self.tree.selection()[0]
self.tree.item.open(item)
except IndexError:
pass
def Enter(self, event):
if event.char == ord(13):
self.buscar()
def buscar(self):
name = NameVar.get()
text = TextVar().get()
etiqueta = TagsVar.get().split(',')
self.aciertos = []
for carpeta in self.direc:
root = tree.insert("", 1, name[-3], text = name[-3])
self.aciertos = []
for versiculo in glob("%s\*" % carpeta):
with open(versiculo, 'r') as nota:
texto = nota.readlines()
etiquetas = texto[-1].split(',')
if name != '':
versiculo = versiculo.replace(".txt", "")
if re.search('%s' % name, versiculo):
pass
else:
continue
if etiqueta != []:
for i in etiquetas:
if i in etiqueta:
break
else:
continue
if text != '':
for line in texto:
if re.search(r'%s' % text, line):
break
else:
continue
tree.insert(raiz, "end", name, text = name[-1])
self.aciertos.append(versiculo)
if self.aciertos == []:
self.tree.delete(root)
示例12: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
global e0, e1, e2, e3, e4, e5, e6, e7, e8, CbxVlr, observaciones, scroll, tree, pdfB, add
global cc, arrend, inmueble, codigo, tel, valor
global Cbx, meses, mes1, mes2, tiempo, fechapago, anio, mes
global prop, nit, tp, subtotal, iva, total
#VARIABLES
tiempo = datetime.date.today()
anio = time.strftime("%Y")
mes = time.strftime("%B")
fechapago = StringVar()
cc = StringVar()
arrend = StringVar()
inmueble = StringVar()
codigo = StringVar()
tel = StringVar()
valor = DoubleVar()
prop = StringVar()
nit = StringVar()
tp = StringVar()
subtotal = DoubleVar()
iva = DoubleVar()
total = DoubleVar()
mes1 = StringVar()
mes2 = StringVar()
meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
#WIDGETS
#=========================== HEADER ============================
self.titleL = Label(self, text="FACTURA INQUILINO", font="bold")
self.titleL.pack(pady=20, side=TOP)
#========================= WRAPPER 1 ===========================
wrapper = Frame (self)
wrapper.pack(fill='both')
#======================= DATOS GENERALES =======================
self.lf = LabelFrame(wrapper, text="Datos generales")
self.lf.pack(side=LEFT)#-------------------------------
self.f0 = Frame(self.lf)
self.f0.pack(pady=5,fill=X)#---------------------------
self.ccnitL = Label(self.f0, text='CC/Nit:')
self.ccnitL.pack(side=LEFT)
e0 = Entry(self.f0, textvariable=cc, width=30)
e0.pack(side=LEFT)
self.b1 = Button (self.f0, text='Buscar', command=buscar)
self.b1.pack(side=LEFT)
self.f1 = Frame(self.lf)
self.f1.pack(pady=5,fill=X)#---------------------------
self.nombreL = Label(self.f1, text='Nombre:')
self.nombreL.pack(side=LEFT)
e1 = Entry(self.f1, textvariable=arrend, width=50, state=DISABLED)
e1.pack(side=LEFT,fill=X)
self.f2 = Frame(self.lf)
self.f2.pack(pady=5,fill=X)#---------------------------
self.inmuebleL = Label(self.f2, text='Inmueble:')
self.inmuebleL.pack(side=LEFT)
e2 = Entry(self.f2, textvariable=inmueble, state=DISABLED, width=48)
e2.pack(side=LEFT,fill=X)
self.f3 = Frame(self.lf)
self.f3.pack(pady=5,fill=X)#---------------------------
self.inmuebleL = Label(self.f3, text='Código: ')
self.inmuebleL.pack(side=LEFT)
e3 = Entry(self.f3, textvariable=codigo, state=DISABLED, width=5)
e3.pack(side=LEFT,fill=X)
self.tel = Label(self.f3, text='Teléfono: ')
self.tel.pack(side=LEFT)
e4 = Entry(self.f3, textvariable=tel, state=DISABLED, width=15)
e4.pack(side=LEFT,fill=X)
self.precio = Label(self.f3, text='Arriendo $: ')
self.precio.pack(side=LEFT)
e5 = Entry(self.f3, textvariable=valor, state=DISABLED, width=15)
e5.pack(side=LEFT,fill=X)
#======================= DATOS PROPIETARIO =======================
wrap = Frame(wrapper)
wrap.pack(side=RIGHT)
#.........这里部分代码省略.........
示例13: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [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)
示例14:
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [as 别名]
keywords.heading("#0", text="Word")
keywords.heading("Frequency", text="Frequency")
keywords.column("#0", anchor=tk.CENTER)
keywords.column("Frequency", anchor=tk.CENTER)
keywordIndex={}
top10Words=topWords[-10:]
tree_i=0
for index,row in top10Words.iteritems():
treeind=keywords.insert(parent="",index=0,text=str(index), values=(str(row)))
keywordIndex[tree_i]=treeind
tree_i+=1
rightPan.add(keywords)
keywords.pack()
#Sample
lab4 =tk.Label(rightPan, text="Categorization Sample",font='arial 10 bold')
rightPan.add(lab4)
lab4.pack()
scrollbar = tk.Scrollbar(rightPan)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
listbox = tk.Text(rightPan,wrap=tk.WORD,width=55,height=40)
listbox.pack()
# attach listbox to scrollbar
示例15: __init__
# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import pack [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)
#.........这里部分代码省略.........