wx.ProgressDialog and PD_APP_MODAL.

I'm having some trouble with ProgressDialog and the PD_APP_MODAL flag,
but I'm having trouble reproducing it in a meaningful, minimal code
sample. The smallest code sample that does work looks like this:

  app = wx.PySimpleApp()
  f = wx.Frame(None, -1, "Progress Dialog Test")
  f.Show()
  dlg = wx.ProgressDialog("Progressing", "Please wait")
  app.MainLoop()

That gives me my expected behavior - the Progress Dialog is displayed
and the Frame does not accept user input. In my application that
doesn't happen. I can create the ProgressDialog using exactly the
same call, and it displays, but the Frame and it's other children all
continue to respond to user input. I'm not sure why or how that'd
happen and I'm not sure where to look. At one point the
ProgressDialog was being created in the onOk handler for another
dialog. I tried creating a method on my Frame class that looked like
this:

  def ProgressDlg(self):
    dlg = ProgressDialog("Working", "Please wait while the selected
operation takes place.")

That I could call into, but the behavior is the same - no modal
state. Any suggestions on where to look would help a ton.

I posted earlier that I thought I’d found it, but I was mistaken. This time though I do believe I’ve got it.

The trouble (as far as I can tell) is that the Progress Dialog was happening in an Event Handler, which appears to take place outside of the main Thread. If I use wx.CallAfter to let execution return to the main Thread the Dialog properly prevents access to the other elements in the UI.