Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Add(tk.Frame):
- posy = 0.3063
- nentry = 1
- entry = list()
- var = list()
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.controller = controller
- self.configure(bg=color["giallo_bg"])
- l1 = tk.Label(self, text=title, font=('Helvetica', 60), bg=color["giallo_bg"])
- l2 = tk.Label(self, text="Aggiungi match", font=('Helvetica', 40), bg=color["giallo_bg"])
- bt_return = tk.Button(self, text='Ritorna alla home', font=('Helvetica', 15), command=lambda: controller.show_frame("Main"))
- l3 = tk.Label(self, text="Inserisci l'ingrediente principale", font=('Helvetica', 20), bg=color["giallo_bg"])
- l4 = tk.Label(self, text="Inserisci gli ingredienti secondari", font=('Helvetica', 20), bg=color["giallo_bg"])
- global var_main
- var_main = tk.StringVar(value='')
- e1 = tk.Entry(self, textvariable=var_main, width=30)
- bt_more = tk.Button(self, text='+ Match', font=('Helvetica', 15), command=self.more)
- self.var.append(tk.StringVar(value=''))
- self.entry.append(tk.Entry(self, textvariable=self.var[0], width=30))
- bt_save = tk.Button(self, text='Salva', font=('Helvetica', 15), command=self.save)
- l1.pack()
- l2.pack()
- l3.place(relx=0, rely=0.2)
- l4.place(relx=0, rely=0.3)
- self.entry[0].place(relx=0.21, rely=self.posy)
- e1.place(relx=0.2, rely=0.2063)
- bt_more.place(relx=0.35, rely=0.3)
- bt_save.place(relx=0.35, rely=0.35)
- bt_return.place(relx=0.465, rely=0.90)
- def save(self):
- content = list()
- for count in range(len(self.entry)):
- content.append(self.var[count].get())
- main = var_main.get()
- database.save(main, content)
- def more(self):
- if self.nentry == 19:
- pass
- else:
- self.posy += 0.03
- self.var.append(tk.StringVar(value=''))
- self.entry.append(tk.Entry(self, textvariable=self.var[len(self.entry)], width=30))
- self.entry[self.nentry].place(relx=0.21, rely=self.posy)
- self.nentry += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement