[Tutor] Trying out Tkinter with problems
glingl at aon.at
Sat Feb 19 10:43:07 CET 2005
I'm not a Tkinter expert, so I probably cannot provide
the best solution for your problem.
Nevertheless I tried two corrections, which adress your
problem seeminly successfully
Adam Cripps schrieb:
> I'm trying out Tkinter as one of my first forays into GUI programming.
> However, I'm having a couple of problems.
> My intitial efforts can be seen at:
> http://www.monkeez.org/code/python/tkinter/min.txt or here .
> Firstly, I'm trying to grab the contents of Entry widget entry1 with a
> StringVar and take that value to another function to print the value
> to the command line. However, my function 'printentry' always runs
> when the application is run, without the button being pressed. Then,
> when I do press the button, the function isn't called. However, this
> button is just the same as all the other buttons. Why is this?
This is because of
in createWidgets. Here you don't assign the method pintentry
to command, but the result of executing this method. (So it is
ececuted, when createWidget is called, but not when the command
self.save2Button = Button(self, text = "Submit",
print "ok - the submit has been pressed - \
I need to get it's value"
> Secondly, when I try to exit the app, the quit button doesn't kill the
> root, window, but just the widgets. How do I reference the root window
> and all, instead of just exiting the widgets?
self.destroy destroys the frame, not the root window.
"Do you really wish to quit?"):
I'm not sure if this is the canonical way of exiting a
Tkinter-App :-( (Perhaps somebody knows more.)
Hope this helps,
> TIA - Adam
Telefon: +43 1 713 33 98
Mobil: +43 664 140 35 27
Autor von "Python für Kids"
More information about the Tutor