TK program problem

Chris Angelico rosuav at gmail.com
Sun May 22 10:25:06 EDT 2011


On Mon, May 23, 2011 at 12:03 AM, rantingrick <rantingrick at gmail.com> wrote:
> ... was about as effective as the "orb of confusion" on Patrick...
> *drool*
>

That sounds like a Dungeons and Dragons artifact item... invoking the
orb of confusion is a standard action that does not provoke an Attack
of Opportunity.

> class MyDialog(blah):
>   blah,blah,blah
>
> def show_dialog(*args):
>    d = MyDialog(*args)
>    return d.result
>
> result = show_dialog()

I don't really see why it shouldn't be valid to use the class itself
in this way. Once the constructor returns, the object IS the return
value.

But then, my opinion may not be valid. I've done weird things in C++
where, for instance, the invocation of a modeless dialog is:

new FoobarDialog(params);

And somewhere it has an event (eg when the window is destroyed) that executes:

delete this;

I'm a little mad and generally silly, so my opinion doesn't matter
(matter matter matter matter). But it did work, and the code was nice
and clean!

Chris Angelico



More information about the Python-list mailing list