Click here to Skip to main content
15,916,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So, what i wanna do is that when i click the button, a new thing to be added to my project.

I have few tabs, and on the second one (WorkExp) I got Company and job description labels, and i want that whenever i click the button it to add new same labels.

it works, the button, but the thing is add the placement on these new labels is the same as old ones.

I tried while and for cycle but i couldnt make any of them work.

What I have tried:

WorkExp = ttk.Frame(Tabs)
Tabs.add(WorkExp, text = "Work Experience")

######################
def AddExp():
Label(WorkExp, text = "Company/Place", padx = 5, pady = 5).grid(row = 3, column = 1)
Label(WorkExp, text="Job Description", padx=5, pady=5).grid(row = 4 , column=1)
Comp2 = Entry(WorkExp).grid(row=3, column=2)
Work2 = Entry(WorkExp).grid(row=4, column=2)

######################
Label(WorkExp, text = "Company/Place", padx = 5, pady = 5).grid(row = 1, column = 1)
Label(WorkExp, text = "Job Description", padx = 5, pady = 5).grid(row = 2, column = 1)

Comp1 = Entry(WorkExp).grid(row = 1, column = 2)
Work1 = Entry(WorkExp).grid(row = 2, column = 2)

Button(WorkExp, text = "Add Experience", command = AddExp).grid(row = 10, column = 1)
Posted
Updated 8-May-20 3:06am

1 solution

Your AddExp function always adds its components in the same place. You need to pass it the new row and column values for correct placement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900