with open('d:/atxt','r',encoding='utf-8') as f:
address=[]
n=0
for x in freadlines():
n+=1
if '某' in x:
addressappend('{}行{}列'format(n,xindex('某')+1))
print(address)
我在Tkinter用Treeview做了一张桌子。我想将第6列中的所有值相加,并在输入框中显示该数字。我该怎么做?我不知道如何从treeview表中获取值,然后以有意义的方式使用它们。get()不存在。get\u子项根本不起作用。谢谢你的帮助
from tkinter import
from tkinter import ttk
f1= tk()
rootgeometry("750x500")
Invoice_Maker = LabelFrame(f1, text = "Invoice")
Invoice_Makergrid(row=8,column=0,columnspan=4)
Qty_Label = Label(Invoice_Maker, text = " Qty:")
Qty_Labelgrid(row=0,column=0)
Quantity_Box = Entry(Invoice_Maker, width=15)
Quantity_Boxgrid(row=0,column=1)
clicked = StringVar()
clickedset("Select Item")
Dropdown = OptionMenu(Invoice_Maker, clicked, "Bandana", "Du-Rag/Stocking cap",
"Winter Hats", "Gloves", "A-shirt", "Belt",
"Capdana", "Mask", "Sleeve","T-shirt RoundNeck", "T-shirt V-Neck",
"T-shirt LongSleeve","Japanese Hat", "Sunglass", "Small Straw Hat", "Cap",
"Bucket Hat", "Safari Hat", "Large Straw Hat", "Banded Straw Hat",
"Neon T-Shirt", "Panama Jack", "Lady Hats", "Fedora", "Straw Hat Ranchero",
"Team Hats", "Speedy Hat", "Misc", "Bike Tires", "Machetes", "Balones")
Dropdowngrid(row=0, column=2)
Style_Label = Label(Invoice_Maker, text = "Style:")
Style_Labelgrid(row = 0, column = 3)
StyleMenu = StringVar()
StyleMenuset("N/A")
Style = OptionMenu(Invoice_Maker,StyleMenu, "Plain","Camo","Neon")
Stylegrid(row=0,column=4)
Cost_Label = Label(Invoice_Maker,text = "Cost:")
Cost_Labelgrid(row=0,column=5)
Cost = Entry(Invoice_Maker, width=7)
Costgrid(row=0, column=6)
Retail_Label = Label(Invoice_Maker,text = "Retail:")
Retail_Labelgrid(row=0,column=7)
Retail = Entry(Invoice_Maker, width=7)
Retailgrid(row=0, column=8)
Inv_Frame = LabelFrame(Invoice_Maker, bg="red")
Inv_Framegrid(row=1,column=0,columnspan=10)
global Trv
Trv = ttkTreeview(Inv_Frame)
Trvpack(side=RIGHT)
Trv["columns"] = ("2","3","4","5","6")
Trvcolumn("#0", width = 40)
Trvcolumn(1, width = 80)
Trvcolumn(2, width = 80)
Trvcolumn(3, width = 80)
Trvcolumn(4, width = 80)
Trvcolumn(5, width = 80)
Trvcolumn(6, width = 80)
Trvheading("#0", text="#", anchor=W)
Trvheading(1, text="Quantity", anchor=W)
Trvheading(2, text="Item", anchor=W)
Trvheading(3, text="Style", anchor=W)
Trvheading(4, text="Cost", anchor=W)
Trvheading(5, text="Retail", anchor=W)
Trvheading(6, text="Total", anchor=W)
Scroll = Scrollbar(Inv_Frame, orient="vertical", command=Trvyview)
Scrollpack(side=LEFT, fill="y")
def Add_Item():
Trvinsert("",END,text=Quantity_Boxget(), values=(clickedget(),StyleMenuget(),Costget(),
Retailget(),str(float(Quantity_Boxget())float(Costget()))))
Total_Label = Label(Invoice_Maker, text="Total: ")
Total_Labelgrid(row=3,column=8)
Total_Box = Entry(Invoice_Maker,width=10)#This is where I want the total of the numbers in row 6 to go
Total_Boxgrid(row=3,column=9)
以上就是关于求一个用python做一个程序,获取纯文字txt中某个文字在文档中的第几行第几列全部的内容,包括:求一个用python做一个程序,获取纯文字txt中某个文字在文档中的第几行第几列、python中如何获取treeview第二行第三列的值、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)