I am attempting to create a program that performs a function given a series of user inputs. Several of the user inputs are only necessary under certain circumstances, and I would like to, if possible, only show the Entry boxes and Labels for those input values when a Checkbutton is selected indicating that the circumstances requiring those inputs are present. What I'm not sure how to do is:
Put the Labels and Entry boxes I'm adding in between rows that already exist.
"Hide" the Labels and Entry boxes when the Checkbutton is deselected, without destroy
ing them, so that they can be displayed again without losing any already-entered data if the Checkbutton is reselected.
- Example: I select the Checkbutton, enter data into the new boxes that appear, then deselect the Checkbutton (causing the boxes to no longer be displayed). If I were to then reselect the Checkbutton, the data I entered the last time the Checkbutton was selected should still be there.
"Show" the same Labels and Entry boxes that had previously been "hidden" if the Checkbutton is reselected after having been previously deselcted.
I don't know if something like this is even possible, but if it's not, please let me know. Also, I am aware that I could simply set the relevant Entry boxes' state
to DISABLED
while the Checkbutton is deselected, but I would prefer, if possible, that the boxes not appear so that their presence does not confuse users who are not familiar with the circumstances under which the additional inputs are necessary.
If this is relevant, I am using Python 2.7.9, Anaconda 2.2.0 (64-bit), and Tkinter version 81008 on Windows 10 Pro. Feel free to request further information if I've left anything out that would be useful to know. Thanks in advance for any help you're able to provide.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…