#!/usr/bin/env python #============================================= # Author: Stephen Engler # Date Thu 07 Feb 2008 03:08:36 PM EST # A simple close window dialog #============================================= import wx import sys class Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, 'Frame') panel = wx.Panel(self) # Grid Bag Sizer... sizer = wx.GridBagSizer( hgap=4, vgap=3) # create A text string txt = wx.StaticText(panel, -1, "Click here to Exit!") # create a button button = wx.Button(panel, -1, 'EXIT') # Add both the button and txt to the sizer sizer.Add(txt,pos=(1,1),span=(1,3),flag=wx.EXPAND) sizer.Add(button,pos=(2,1),span=(1,3),flag=wx.EXPAND) # bind button click event self.Bind(wx.EVT_BUTTON, self.OnClickCallback, button) panel.SetSizer(sizer) panel.Fit() self.Fit() # calback for event def OnClickCallback(self, event): sys.exit() if __name__ == '__main__': app = wx.PySimpleApp() frame = Frame() frame.Show() app.MainLoop()