13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>wxPython</strong> dialogshttp://www.zetcode.com/wxpython/dialogs/def ShowMessage4(self, event):dial = wx.MessageDialog(None, 'Unallowed operation', 'Exclamation', wx.OK |wx.ICON_EXCLAMATION)dial.ShowModal()app = wx.App()Messages(None, -1, 'Messages')app.MainLoop()In our example, we have created four buttons and put them in a gridsizer. <strong>The</strong>se buttons will show four different dialog windows. Wecreate them by specifying different style flags.dial = wx.MessageDialog(None, 'Error loading file', 'Error', wx.OK |wx.ICON_ERROR)dial.ShowModal()<strong>The</strong> creation of the message dialog is simple. We set the dialog to bea toplevel window by providing None as a parent. <strong>The</strong> two stringsprovide the message text and the dialog title. We show an ok buttonand an error icon by specifying the wx.OK and wx.ICON_ERRORflags. To show the dialog on screen, we call the ShowModal()method.4 de 11 27/04/2008 1:04

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!