import wx

class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)

class MyPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        btn = wx.Button(self, -1, label='Click me')
        btn.Bind(wx.EVT_BUTTON, self.onButton)
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(btn)
        self.SetSizer(box)
        box.Fit(parent)

    def onButton(self, evt):
        self.dlg = wx.ProgressDialog("Progress dialog example",
                               "Processing request",
                               parent=self,
                               style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL
                                )
        pulse = True
        while pulse:
            (pulse, skip) = self.dlg.Pulse()
        self.dlg.Destroy()

class MyApp(wx.App):
    def __init__(self, redir):
        wx.App.__init__(self, redir)
        frame = MyFrame(None)
        panel = MyPanel(frame)
        frame.Show()
        self.MainLoop()

app = MyApp(0)
