tkSimpleDialog.Dialog.ok calls Cancel

Matt H mghemke at gmail.com
Mon Apr 4 15:06:16 EDT 2011


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?



More information about the Python-list mailing list