(n00b) Tkinter trouble

Jason Swails jason.swails at gmail.com
Wed Nov 16 15:42:52 EST 2011


On Tue, Nov 15, 2011 at 10:49 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Wed, Nov 16, 2011 at 2:02 PM, Jason Swails <jason.swails at gmail.com>
> wrote:
> > Apparently I could not do what I was wanting to (state=DISABLED is not a
> > valid option to Toplevel).  What I wanted to do was something similar to
> > what the dialogs were doing from tkMessageBox.
>
> Yes, that would be what you'd want. I wonder, though: Is Toplevel the
> right window class? There may be a better class for a subwindow.
> Again, I'm not familiar with Tkinter, but a quick google suggests that
> Frame or Window might be worth looking into. Ideally, you want the
> window to disable its parent and claim all events.
>

I think Toplevel is right.  Frame isn't actually a window (a window has to
be its parent), and I've never seen any documentation regarding a Window
class (perhaps it's just meant to be a base class that Toplevel inherits
from?).  I think a separate window needs to be a Toplevel instance (or
instance of a Toplevel-derived class).

Pulling on the tkMessageBox example again, their base Dialog class inherits
from Toplevel.  In any case, I've actually found that Tkinter is relatively
straightforward to learn, despite some of the bashing it's received here
(admittedly I've never tried PyGTK or wxpython or any of the other toolkits
because I want to keep dependencies within the stdlib as much as possible).

Thanks!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111116/bfe324b1/attachment-0001.html>


More information about the Python-list mailing list