John Salerno wrote:
I'm not exactly sure how to call the method ShowModal(). This is what
I have so far:
try this instead:
import wx
class InputForm(wx.Frame):
def __init__(self, parent=None, id=wx.ID_ANY, title=''):
wx.Frame.__init__(self, parent, id, title)
panel = wx.Panel(self)
btnModal = wx.Button(panel, -1, 'Modal')
self.Bind(wx.EVT_BUTTON, self.OnShowDialog, btnModal)
def OnShowDialog(self, evt):
dialog = wx.Dialog(self, -1, 'Modal Dialog')
dialog.ShowModal()
dialog.Destroy()
class MyApp(wx.App):
def OnInit(self):
frame = InputForm(title='Data Entry Form')
self.SetTopWindow(frame)
frame.Show()
return True
app = MyApp(redirect=False)
app.MainLoop()
Also, are there any predefined classes that you can use for commonly
used objects, such as a dialog box with an OK and Cancel button
already in it, that behave as you would expect when clicked?
Yep. Look in the demo under "Common Dialogs"
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!