MessageBox ONOK?
Jimmy Retzlaff
jimmy at retzlaff.com
Tue Apr 19 15:26:34 EDT 2005
Ali wrote:
> How do i connect the onOK of a win32ui MessageBox with the Ok button
so
> that I get to know when the user clicks the Ok button?
win32ui.MessageBox returns the ID of the button that was clicked to
dismiss the message box. There are constants in win32con you can use to
compare to that ID. An example:
>>> import win32con
>>> import win32ui
>>> buttonID = win32ui.MessageBox('Hello World')
>>> if buttonID == win32con.IDOK:
... print 'OK pressed'
... else:
... print 'OK not pressed'
...
OK pressed
I clicked OK when the dialog appeared. There are also constants for
IDCANCEL, IDYES, IDNO, etc. which can be useful if you are using other
buttons (e.g., win32ui.MessageBox('Do it?', None, win32con.MB_YESNO)).
Jimmy
More information about the Python-list
mailing list