Originally Posted by jrcagle
root.input_text = Text(root, ...) # rest of options go in ...
Now, Python will make input_text a data member of root, which is what you wanted anyways.
Originally Posted by
Haze
Would this not mean that your just changing the variable to root.input.text should it not be like this
input_text = root.Text(root, ...) # rest of options go in
Well, here's what the first one means:
* Create a Text widget.
* Assign the return value (the Text widget object itself) to the variable root.input_text.
So yes, it does change the value of root.input_text, by setting it equal to the Text widget. Previously, root.input_text did not exist, so that's not a problem; you haven't clobbered anything.
Here's what the second one means:
* call the function root.Text() (which doesn't exist, since Tk objects don't a function called Text())
* Assign the return value to the local variable input_text.
You don't want that, since input_text will go out of scope when your function ends, and then you lose ability to access it.
I hope that's clear...
Originally Posted by Hazel
The command part was intended to mean that when the button was selected it would disable the input_text widget. Should i create a function that does this then put that as the command?
Ah... yes, you should create a new function and supply the name of that function as the command.
Jeff