[Tutor] Fun with Label and Entry--Why NoneType?
John Fouhy
john at fouhy.net
Wed Mar 18 03:11:04 CET 2009
2009/3/18 Wayne Watson <sierra_mtnview at sbcglobal.net>:
> Not at all. I took Grayson's example as it stood. However, as it might have
> been noted above, he was working with Pmw, so the code may be a false
> impression of how it works in Tkinter.
>
> This gave the same results:
> root = Tk()
> dialog = DialogPrototype(root)
> root.mainloop()
>
> Extra blank window at start up and crashed the same way when pressing OK.
> I'm using this code to prototype a larger dialog with more data entry, so it
> doesn't really matter that it crashes when I exit.
Well, my Tkinter is pretty rusty, but I'm guessing that your dialog
may not work if there is no event loop running.
Try this:
root = Tk()
root.after_idle(DialogPrototype, root)
root.mainloop()
See docs here for the after_idle() method:
http://effbot.org/tkinterbook/widget.htm
--
John.
More information about the Tutor
mailing list