Sometimes the internet offers too many choices,
without explicitely stating what the best solution is in what circonstance.
My app involves a user answering multiple choice questions, he has 10 senconds to enter his choice.
When he feels ready, he starts each new question with a "start" button.
This button should disappear when he presses it, only to re-appear when the 10 secs are up. Works fine.
We create the button in a grid like so:
Now I need to remove it, and i found 3 possibilities:
butOK.grid_remove()
butOK.grid_forget()
butOK.destroy()
10 seconds later i recreate it with the same line as above.
I am getting no errors in either method but the internet warns that:
_remove -> will build up new buttons each time you recreate it, thus penalizing memory usage...?
_forget -> will cause a memory leak ...?
.destroy -> don't know...
Question: what method is the best for creating/ "removing"/creating/ "removing"...etc maybe for 50 questions..;
Maybe there is a 4th method i haven't found yet.
(Of course i could do (state=DISABLED) but that is visually less appealing)
Thx,
Paul
without explicitely stating what the best solution is in what circonstance.
My app involves a user answering multiple choice questions, he has 10 senconds to enter his choice.
When he feels ready, he starts each new question with a "start" button.
This button should disappear when he presses it, only to re-appear when the 10 secs are up. Works fine.
We create the button in a grid like so:
1 |
butOK = Button(root, text = ' Start (10s) ' , font = 'ARIAL 14 bold' , command = answer, bg = 'lightgreen' ) |
butOK.grid_remove()
butOK.grid_forget()
butOK.destroy()
10 seconds later i recreate it with the same line as above.
I am getting no errors in either method but the internet warns that:
_remove -> will build up new buttons each time you recreate it, thus penalizing memory usage...?
_forget -> will cause a memory leak ...?
.destroy -> don't know...
Question: what method is the best for creating/ "removing"/creating/ "removing"...etc maybe for 50 questions..;
Maybe there is a 4th method i haven't found yet.
(Of course i could do (state=DISABLED) but that is visually less appealing)
Thx,
Paul