views:

52

answers:

1
+1  Q: 

tkMessageBox

Hello,

Can anybody help me out in how to activate 'close' button of askquestion() of tkMessageBox??

A: 

By 'activate', do you mean make it so the user can close the message box by clicking the close ('X') button?

I do not think it is possible using tkMessageBox. I guess your best bet is to implement a dialog box with this functionality yourself.

BTW: What should askquestion() return when the user closes the dialog box?

codeape
i dont need a retun type when it closes...when i push "yes" it returns yes.Similarly for "No"
So you want it to return None on close. AFAIK, it cannot be done with tkMessageBox. Implement your own dialog box class/functions. See http://effbot.org/tkinterbook/tkinter-dialog-windows.htm . The tkSimpleDialog module is part of the standard python distro. Inherit that, see the example under 'Creating a simple dialog, revisited', where the apply() method sets a return value.
codeape
thank you for your suggestion
How to write text on a frame while creating dialog boxes using Tkinter ?
I suggest you add a label widget to the dialog box.
codeape