[Tutor] Need help
niraj pandey
nirajkumarpandey at gmail.com
Wed Sep 28 03:00:34 EDT 2016
Found the solution for this .
entry_option = ['Flat_No','Mains Unit','DG Unit','Month']
r = 0
entry = {}
label = {}
for item in entry_option:
lb = Label(bg = 'orange', text=item, relief=RIDGE,width=30)
lb.grid(row=r,column=0)
label[item] = lb
e = Entry(relief=SUNKEN,width=30)
e.grid(row=r,column=1)
entry[item] = e
r=r+1
But now how to pass these values as an argument for this function ?
command=lambda: database.data(E1.get(), E2.get(), E3.get(), E4.get())
Thanks
Niraj
On Wed, Sep 28, 2016 at 10:52 AM, niraj pandey <nirajkumarpandey at gmail.com>
wrote:
> Hi,
>
> I am new in python. Could you guys please help me to short this code ?
>
> Want to write this iteration (Yellow one) using loop.
>
> r = 0
> L1 = Label(bg = 'orange', text="Flat_No", relief=RIDGE,width=30)
> L1.grid(row=0,column=0)
> E1 = Entry(relief=SUNKEN,width=30)
> E1.grid(row=0,column=1)
> L2 = Label(bg = 'orange', text="Mains Unit", relief=RIDGE,width=30)
> L2.grid(row=1,column=0)
> E2 = Entry(relief=SUNKEN,width=30)
> E2.grid(row=1,column=1)
> L3 = Label(bg = 'orange', text="DG Unit", relief=RIDGE,width=30)
> L3.grid(row=2,column=0)
> E3 = Entry(relief=SUNKEN,width=30)
> E3.grid(row=2,column=1)
> L4 = Label(bg = 'orange', text="Month", relief=RIDGE,width=30)
> L4.grid(row=3,column=0)
> E4 = Entry(relief=SUNKEN,width=30)
> E4.grid(row=3,column=1)
>
>
> MyButton1 = Button(top, text="Submit", width=10, bg='red', command=lambda:
> database.data(E1.get(), E2.get(), E3.get(), E4.get()))
> MyButton1.grid(row=8, column=1)
>
> The output should be like this :
>
> [image: Inline image 1]
>
> Thanks
> Niraj
> --
> Success occurs when opportunity and preparation meet
>
--
Success occurs when opportunity and preparation meet
More information about the Tutor
mailing list