我想从任何行或所有输入并具有文本的行中获取数据
就像这张照片
我想在这张照片多行时抓取数据
如何从每一行获取该数据(逐行)
我可以在列表或数据库中获取所有行并将其排序吗?
我可以得到所有的行并将它们打印在一个文件中吗?
from tkinter import *
from tkinter.messagebox import *
class add_new_radio:
def __init__(self, toplevel):
self.toplevel = toplevel
self.All_widgets()
self.toplevel.mainloop()
def All_widgets(self):
self.med_name = StringVar()
self.label_row_general = IntVar()
self.label_row_general.set(0)
self.med_ajouter(self.label_row_general.get())
def ajouter_plus(self):
self.add_btn.grid_forget()
self.cancel_btn.grid_forget()
self.confirme_btn.grid_forget()
self.print_btn.grid_forget()
self.nbr = self.label_row_general.get()+1
self.label_row_general.set(self.nbr)
self.med_ajouter(self.nbr)
def med_ajouter(self, row_nbr):
self.label_row = row_nbr
Label(self.toplevel, text="Name").grid(
row=self.label_row, column=0, padx=5, pady=5)
Label(self.toplevel, text="Date").grid(
row=self.label_row, column=2, padx=5, pady=5)
Label(self.toplevel, text="From").grid(
row=self.label_row, column=4, padx=5, pady=5)
Label(self.toplevel, text="Qt/j").grid(row=self.label_row,
column=6, padx=5, pady=5)
self.medicament_entry = Entry(self.toplevel, text=self.med_name)
self.date_entry = Entry(self.toplevel)
self.duree_entry = Entry(self.toplevel)
self.qt_j_entry = Entry(self.toplevel)
self.medicament_entry.grid(
row=self.label_row, column=1, padx=5, pady=5)
self.date_entry.grid(row=self.label_row, column=3, padx=5, pady=5)
self.duree_entry.grid(row=self.label_row, column=5, padx=5, pady=5)
self.qt_j_entry.grid(row=self.label_row, column=7, padx=5, pady=5)
self.add_btn = Button(self.toplevel, text="Plus",
command=self.ajouter_plus)
self.add_btn.grid(row=self.label_row, column=8,
padx=5, pady=5, ipadx=15)
self.cancel_btn = Button(self.toplevel, text="Annuler")
self.confirme_btn = Button(
self.toplevel, text="Ajouter")
self.print_btn = Button(self.toplevel, text="Imprimer")
self.cancel_btn.grid(row=self.label_row+1,
column=1, padx=5, pady=5, ipadx=15)
self.confirme_btn.grid(row=self.label_row+1,
column=3, padx=5, pady=5, ipadx=15)
self.print_btn.grid(row=self.label_row+1, column=5,
padx=5, pady=5, ipadx=15)
if __name__ == '__main__':
add_new_radio(Tk())
谢谢你