[Tutor] tk help
Alan Gauld
alan.gauld at btinternet.com
Mon Jan 11 10:02:30 CET 2010
"Kirk Vander Meulen" <kvander11 at gmail.com> wrote
> I'm working on a program partly to get the hang of gui programming. I'm
> a
> bit puzzled by the behavior of simple dialogs- I wonder why, in the
> following code, the second call to tkMessageBox.askyesno always returns
> 'False' (either 'yes' or 'no' return False!). If I take out the call to
> tkFileDialog.askdirectory(), the second call works as expected
> (yes->True,no->False). I would really appreciate if someone could take a
> look at this and tell me what I'm missing. Thanks,
After converting the imports for Python 3 it worked perfectly for me
>>> ================================ RESTART
>>> ================================
>>>
True
True
H:/PROJECTS/Python/Tutor3
True
H:/PROJECTS/Python/Tutor3
>>> ================================ RESTART
>>> ================================
>>>
> import tkFileDialog,tkMessageBox
> addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
> print(addDirectory)
> theDirectory=tkFileDialog.askdirectory()
> print(addDirectory)
Any reason why you print it a second time even though there has been no
change?
> print(theDirectory)
> addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
> print(addDirectory)
> print(theDirectory)
And the same here?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list