Showing MessageBox
MessageBox
is one of the most common and recognizable UI components of nearly any application on any platform. It provides a very simple way to present information to the user and requires their acknowledgement of the information that is presented. It can also be used as a way to request and get responses to questions and decisions that the program may need to ask the user about. In this recipe, we will take a look at some of the different ways to show MessageBox
.
How to do it…
Perform the following steps:
- Let's make a simple
Frame
class that will showMessageBox
when a button is clicked on. The first step is to define the class and do a simple layout, as follows:class MyFrame(wx.Frame): def __init__(self, parent, title): super(MyFrame, self).__init__(parent, title=title) panel = wx.Panel(self) button = wx.Button(panel, label="Show MessageBox") hsizer = wx.BoxSizer() hsizer.AddStretchSpacer() hsizer...