Problems using tkSimpleDialog

Simon Brunning simon at brunningonline.net
Wed Dec 12 04:39:03 EST 2001


"Eric Brunel" <eric.brunel at pragmadev.com> wrote in message news:<9v5boc$2auh$1 at norfair.nerim.net>...
>
> The problem is simple: Tk needs to be initialized before the
> "tkSimpleDialog" module can work. Just do:
> import Tkinter
> root = Tkinter.Tk()
> before calling tkSimpleDialog.askstring, and it will magically solve the
> problem.
> 
> What happens is that if you don't explicitely set the "parent" option for
> your dialog, a default one is chosen which is "the" instance of the Tk class
> for your application, corresponding to its main window. Apparently, if this
> instance was not created "manually", the "tkSimpleDialog" module does not
> create one automatically.
> 
> Hope this helps.
>  - eric -

Thanks Eric. That does help. Problem is, the Tkinter.Tk() thing brings
up an empty parent window, which I don't want. Ah well, back to the
drawing board!

Cheers,
Simon B.



More information about the Python-list mailing list