tkSimpleDialog.Dialog.ok calls Cancel

M

Matt H

I am subclassing tkSimpleDialog.Dialog as a (sqlite) database front-
end. This parent dialog opens a number of child dialogs to propagate
sub-tables (like sub-forms in OOo). These subforms write their input
into the database (INSERT...)

The parent dialog then either commits or rolls-back transactions based
on whether the user clicks ok or cancel. This ensures that if
something is written to the db in a subform, that it doesn't stay in
the database if the user chooses cancel (the rollback transaction code
is in cancel).

I have everything working except for the fact that python
tkSimpleDialog.ok calls tkSimpleDialog.cancel to clean up, which means
all of my transactions get cancelled (even if the user clicks ok). Is
there a way to do this without re-implementing or copying the
tkSimpleDialog.Dialog ok and cancel methods entirely?

In other words, how do I make OK not execute cancel?
 
R

rantingrick

I am subclassing tkSimpleDialog.Dialog as a (sqlite) database front-
end. This parent dialog opens a number of child dialogs to propagate
sub-tables (like sub-forms in OOo). These subforms write their input
into the database (INSERT...)

The parent dialog then either commits or rolls-back transactions based
on whether the user clicks ok or cancel. This ensures that if
something is written to the db in a subform, that it doesn't stay in
the database if the user chooses cancel (the rollback transaction code
is in cancel).

I have everything working except for the fact that python
tkSimpleDialog.ok calls tkSimpleDialog.cancel to clean up, which means
all of my transactions get cancelled (even if the user clicks ok). Is
there a way to do this without re-implementing or copying the
tkSimpleDialog.Dialog ok and cancel methods entirely?

In other words, how do I make OK not execute cancel?

The ok and cancel methods are just a few lines of code for crying out
loud. And besides, you must have inherited from this class anyway to
create your custom dialog. If copy paste is not working for you then i
would suggest building a better light bulb. Tesla did it (and one-
upped that old fart and cheat Edison) so why can't you?

PS: And besides, the tkSimpleDialog class was ill conceived from day
one. Search the archives for my discussions on the pitfalls of this
code and my suggestions for curing (some) the many problems contained
within.

PPS: Not to say that a modal dialog that self closes is a design flaw
BTW!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top