]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/src/gtk/wx.py
new wxMenu stuff and thread implementations
[wxWidgets.git] / utils / wxPython / src / gtk / wx.py
index c3206e03f2d3ca00d6d866c5efe66b166d76b620..09e308771fd819fa1154d3b3c32dbd3ac3ab6e4e 100644 (file)
@@ -30,78 +30,79 @@ from windows3 import *
 from image import *
 
 from printfw import *
+
+from sizers import *
 class wxPyAppPtr(wxEvtHandlerPtr):
     def __init__(self,this):
         self.this = this
         self.thisown = 0
-    def __del__(self, wxc=wxc):
+    def __del__(self,wxc=wxc):
         if self.thisown == 1 :
-            wxc.delete_wxPyApp(self.this)
-    def GetAppName(self):
-        val = wxc.wxPyApp_GetAppName(self.this)
+            wxc.delete_wxPyApp(self)
+    def GetAppName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetAppName,(self,) + _args, _kwargs)
         return val
-    def GetClassName(self):
-        val = wxc.wxPyApp_GetClassName(self.this)
+    def GetClassName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetClassName,(self,) + _args, _kwargs)
         return val
-    def GetExitOnFrameDelete(self):
-        val = wxc.wxPyApp_GetExitOnFrameDelete(self.this)
+    def GetExitOnFrameDelete(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetExitOnFrameDelete,(self,) + _args, _kwargs)
         return val
-    def GetPrintMode(self):
-        val = wxc.wxPyApp_GetPrintMode(self.this)
+    def GetPrintMode(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetPrintMode,(self,) + _args, _kwargs)
         return val
-    def GetTopWindow(self):
-        val = wxc.wxPyApp_GetTopWindow(self.this)
-        val = wxWindowPtr(val)
+    def GetTopWindow(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetTopWindow,(self,) + _args, _kwargs)
+        if val: val = wxWindowPtr(val) 
         return val
-    def GetVendorName(self):
-        val = wxc.wxPyApp_GetVendorName(self.this)
+    def GetVendorName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetVendorName,(self,) + _args, _kwargs)
         return val
-    def Dispatch(self):
-        val = wxc.wxPyApp_Dispatch(self.this)
+    def Dispatch(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_Dispatch,(self,) + _args, _kwargs)
         return val
-    def ExitMainLoop(self):
-        val = wxc.wxPyApp_ExitMainLoop(self.this)
+    def ExitMainLoop(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_ExitMainLoop,(self,) + _args, _kwargs)
         return val
-    def Initialized(self):
-        val = wxc.wxPyApp_Initialized(self.this)
+    def Initialized(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_Initialized,(self,) + _args, _kwargs)
         return val
-    def MainLoop(self):
-        val = wxc.wxPyApp_MainLoop(self.this)
+    def MainLoop(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_MainLoop,(self,) + _args, _kwargs)
         return val
-    def Pending(self):
-        val = wxc.wxPyApp_Pending(self.this)
+    def Pending(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_Pending,(self,) + _args, _kwargs)
         return val
-    def ProcessIdle(self):
-        val = wxc.wxPyApp_ProcessIdle(self.this)
+    def ProcessIdle(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_ProcessIdle,(self,) + _args, _kwargs)
         return val
-    def SetAppName(self,arg0):
-        val = wxc.wxPyApp_SetAppName(self.this,arg0)
+    def SetAppName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetAppName,(self,) + _args, _kwargs)
         return val
-    def SetClassName(self,arg0):
-        val = wxc.wxPyApp_SetClassName(self.this,arg0)
+    def SetClassName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetClassName,(self,) + _args, _kwargs)
         return val
-    def SetExitOnFrameDelete(self,arg0):
-        val = wxc.wxPyApp_SetExitOnFrameDelete(self.this,arg0)
+    def SetExitOnFrameDelete(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetExitOnFrameDelete,(self,) + _args, _kwargs)
         return val
-    def SetPrintMode(self,arg0):
-        val = wxc.wxPyApp_SetPrintMode(self.this,arg0)
+    def SetPrintMode(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetPrintMode,(self,) + _args, _kwargs)
         return val
-    def SetTopWindow(self,arg0):
-        val = wxc.wxPyApp_SetTopWindow(self.this,arg0.this)
+    def SetTopWindow(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetTopWindow,(self,) + _args, _kwargs)
         return val
-    def SetVendorName(self,arg0):
-        val = wxc.wxPyApp_SetVendorName(self.this,arg0)
+    def SetVendorName(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_SetVendorName,(self,) + _args, _kwargs)
         return val
-    def GetStdIcon(self,arg0):
-        val = wxc.wxPyApp_GetStdIcon(self.this,arg0)
-        val = wxIconPtr(val)
-        val.thisown = 1
+    def GetStdIcon(self, *_args, **_kwargs):
+        val = apply(wxc.wxPyApp_GetStdIcon,(self,) + _args, _kwargs)
+        if val: val = wxIconPtr(val) ; val.thisown = 1
         return val
     def __repr__(self):
-        return "<C wxPyApp instance>"
+        return "<C wxPyApp instance at %s>" % (self.this,)
 class wxPyApp(wxPyAppPtr):
-    def __init__(self:
-        self.this = wxc.new_wxPyApp()
+    def __init__(self,*_args,**_kwargs):
+        self.this = apply(wxc.new_wxPyApp,_args,_kwargs)
         self.thisown = 1
 
 
@@ -111,14 +112,14 @@ class __wxPyCleanupPtr :
     def __init__(self,this):
         self.this = this
         self.thisown = 0
-    def __del__(self, wxc=wxc):
+    def __del__(self,wxc=wxc):
         if self.thisown == 1 :
-            wxc.delete___wxPyCleanup(self.this)
+            wxc.delete___wxPyCleanup(self)
     def __repr__(self):
-        return "<C __wxPyCleanup instance>"
+        return "<C __wxPyCleanup instance at %s>" % (self.this,)
 class __wxPyCleanup(__wxPyCleanupPtr):
-    def __init__(self:
-        self.this = wxc.new___wxPyCleanup()
+    def __init__(self,*_args,**_kwargs):
+        self.this = apply(wxc.new___wxPyCleanup,_args,_kwargs)
         self.thisown = 1
 
 
@@ -168,10 +169,13 @@ wxNO_BORDER = wxc.wxNO_BORDER
 wxUSER_COLOURS = wxc.wxUSER_COLOURS
 wxNO_3D = wxc.wxNO_3D
 wxTAB_TRAVERSAL = wxc.wxTAB_TRAVERSAL
+wxWANTS_CHARS = wxc.wxWANTS_CHARS
 wxHORIZONTAL = wxc.wxHORIZONTAL
 wxVERTICAL = wxc.wxVERTICAL
 wxBOTH = wxc.wxBOTH
 wxCENTER_FRAME = wxc.wxCENTER_FRAME
+wxCENTRE_ON_SCREEN = wxc.wxCENTRE_ON_SCREEN
+wxCENTER_ON_SCREEN = wxc.wxCENTER_ON_SCREEN
 wxSTAY_ON_TOP = wxc.wxSTAY_ON_TOP
 wxICONIZE = wxc.wxICONIZE
 wxMINIMIZE = wxc.wxMINIMIZE
@@ -190,6 +194,11 @@ wxDEFAULT_FRAME_STYLE = wxc.wxDEFAULT_FRAME_STYLE
 wxDEFAULT_DIALOG_STYLE = wxc.wxDEFAULT_DIALOG_STYLE
 wxFRAME_TOOL_WINDOW = wxc.wxFRAME_TOOL_WINDOW
 wxFRAME_FLOAT_ON_PARENT = wxc.wxFRAME_FLOAT_ON_PARENT
+wxED_CLIENT_MARGIN = wxc.wxED_CLIENT_MARGIN
+wxED_BUTTONS_BOTTOM = wxc.wxED_BUTTONS_BOTTOM
+wxED_BUTTONS_RIGHT = wxc.wxED_BUTTONS_RIGHT
+wxED_STATIC_LINE = wxc.wxED_STATIC_LINE
+wxEXT_DIALOG_STYLE = wxc.wxEXT_DIALOG_STYLE
 wxCLIP_CHILDREN = wxc.wxCLIP_CHILDREN
 wxRETAINED = wxc.wxRETAINED
 wxBACKINGSTORE = wxc.wxBACKINGSTORE
@@ -197,12 +206,15 @@ wxTB_3DBUTTONS = wxc.wxTB_3DBUTTONS
 wxTB_HORIZONTAL = wxc.wxTB_HORIZONTAL
 wxTB_VERTICAL = wxc.wxTB_VERTICAL
 wxTB_FLAT = wxc.wxTB_FLAT
+wxTB_DOCKABLE = wxc.wxTB_DOCKABLE
 wxCOLOURED = wxc.wxCOLOURED
 wxFIXED_LENGTH = wxc.wxFIXED_LENGTH
 wxALIGN_LEFT = wxc.wxALIGN_LEFT
 wxALIGN_CENTER = wxc.wxALIGN_CENTER
 wxALIGN_CENTRE = wxc.wxALIGN_CENTRE
 wxALIGN_RIGHT = wxc.wxALIGN_RIGHT
+wxALIGN_BOTTOM = wxc.wxALIGN_BOTTOM
+wxALIGN_TOP = wxc.wxALIGN_TOP
 wxLB_NEEDED_SB = wxc.wxLB_NEEDED_SB
 wxLB_ALWAYS_SB = wxc.wxLB_ALWAYS_SB
 wxLB_SORT = wxc.wxLB_SORT
@@ -218,6 +230,8 @@ wxTE_PASSWORD = wxc.wxTE_PASSWORD
 wxTE_READONLY = wxc.wxTE_READONLY
 wxTE_RICH = wxc.wxTE_RICH
 wxTE_MULTILINE = wxc.wxTE_MULTILINE
+wxTE_AUTO_SCROLL = wxc.wxTE_AUTO_SCROLL
+wxTE_NO_VSCROLL = wxc.wxTE_NO_VSCROLL
 wxCB_SIMPLE = wxc.wxCB_SIMPLE
 wxCB_DROPDOWN = wxc.wxCB_DROPDOWN
 wxCB_SORT = wxc.wxCB_SORT
@@ -250,6 +264,7 @@ wxTR_HAS_BUTTONS = wxc.wxTR_HAS_BUTTONS
 wxTR_EDIT_LABELS = wxc.wxTR_EDIT_LABELS
 wxTR_LINES_AT_ROOT = wxc.wxTR_LINES_AT_ROOT
 wxTR_MULTIPLE = wxc.wxTR_MULTIPLE
+wxTR_SINGLE = wxc.wxTR_SINGLE
 wxTR_HAS_VARIABLE_ROW_HEIGHT = wxc.wxTR_HAS_VARIABLE_ROW_HEIGHT
 wxLC_ICON = wxc.wxLC_ICON
 wxLC_SMALL_ICON = wxc.wxLC_SMALL_ICON
@@ -275,6 +290,8 @@ wxSP_WRAP = wxc.wxSP_WRAP
 wxSP_NOBORDER = wxc.wxSP_NOBORDER
 wxSP_3D = wxc.wxSP_3D
 wxSP_BORDER = wxc.wxSP_BORDER
+wxSP_LIVE_UPDATE = wxc.wxSP_LIVE_UPDATE
+wxSP_PERMIT_UNSPLIT = wxc.wxSP_PERMIT_UNSPLIT
 wxFLOOD_SURFACE = wxc.wxFLOOD_SURFACE
 wxFLOOD_BORDER = wxc.wxFLOOD_BORDER
 wxODDEVEN_RULE = wxc.wxODDEVEN_RULE
@@ -288,6 +305,8 @@ wxYES_NO = wxc.wxYES_NO
 wxCANCEL = wxc.wxCANCEL
 wxYES = wxc.wxYES
 wxNO = wxc.wxNO
+wxNO_DEFAULT = wxc.wxNO_DEFAULT
+wxYES_DEFAULT = wxc.wxYES_DEFAULT
 wxICON_EXCLAMATION = wxc.wxICON_EXCLAMATION
 wxICON_HAND = wxc.wxICON_HAND
 wxICON_QUESTION = wxc.wxICON_QUESTION
@@ -295,6 +314,14 @@ wxICON_INFORMATION = wxc.wxICON_INFORMATION
 wxICON_STOP = wxc.wxICON_STOP
 wxICON_ASTERISK = wxc.wxICON_ASTERISK
 wxICON_MASK = wxc.wxICON_MASK
+wxICON_WARNING = wxc.wxICON_WARNING
+wxICON_ERROR = wxc.wxICON_ERROR
+wxFORWARD = wxc.wxFORWARD
+wxBACKWARD = wxc.wxBACKWARD
+wxRESET = wxc.wxRESET
+wxHELP = wxc.wxHELP
+wxMORE = wxc.wxMORE
+wxSETUP = wxc.wxSETUP
 wxCENTRE = wxc.wxCENTRE
 wxCENTER = wxc.wxCENTER
 wxSIZE_AUTO_WIDTH = wxc.wxSIZE_AUTO_WIDTH
@@ -378,9 +405,32 @@ wxPD_CAN_ABORT = wxc.wxPD_CAN_ABORT
 wxPD_ELAPSED_TIME = wxc.wxPD_ELAPSED_TIME
 wxPD_ESTIMATED_TIME = wxc.wxPD_ESTIMATED_TIME
 wxPD_REMAINING_TIME = wxc.wxPD_REMAINING_TIME
-wxNO_DEFAULT = wxc.wxNO_DEFAULT
 wxMENU_TEAROFF = wxc.wxMENU_TEAROFF
+wxMB_DOCKABLE = wxc.wxMB_DOCKABLE
 wxNO_FULL_REPAINT_ON_RESIZE = wxc.wxNO_FULL_REPAINT_ON_RESIZE
+wxLEFT = wxc.wxLEFT
+wxRIGHT = wxc.wxRIGHT
+wxUP = wxc.wxUP
+wxDOWN = wxc.wxDOWN
+wxALL = wxc.wxALL
+wxTOP = wxc.wxTOP
+wxBOTTOM = wxc.wxBOTTOM
+wxNORTH = wxc.wxNORTH
+wxSOUTH = wxc.wxSOUTH
+wxEAST = wxc.wxEAST
+wxWEST = wxc.wxWEST
+wxSTRETCH_NOT = wxc.wxSTRETCH_NOT
+wxSHRINK = wxc.wxSHRINK
+wxGROW = wxc.wxGROW
+wxEXPAND = wxc.wxEXPAND
+wxNB_FIXEDWIDTH = wxc.wxNB_FIXEDWIDTH
+wxNB_LEFT = wxc.wxNB_LEFT
+wxNB_RIGHT = wxc.wxNB_RIGHT
+wxNB_BOTTOM = wxc.wxNB_BOTTOM
+wxLI_HORIZONTAL = wxc.wxLI_HORIZONTAL
+wxLI_VERTICAL = wxc.wxLI_VERTICAL
+wxHW_SCROLLBAR_NEVER = wxc.wxHW_SCROLLBAR_NEVER
+wxHW_SCROLLBAR_AUTO = wxc.wxHW_SCROLLBAR_AUTO
 wxDEFAULT = wxc.wxDEFAULT
 wxDECORATIVE = wxc.wxDECORATIVE
 wxROMAN = wxc.wxROMAN
@@ -746,6 +796,8 @@ wxEVT_COMMAND_LIST_KEY_DOWN = wxc.wxEVT_COMMAND_LIST_KEY_DOWN
 wxEVT_COMMAND_LIST_INSERT_ITEM = wxc.wxEVT_COMMAND_LIST_INSERT_ITEM
 wxEVT_COMMAND_LIST_COL_CLICK = wxc.wxEVT_COMMAND_LIST_COL_CLICK
 wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxc.wxEVT_COMMAND_LIST_ITEM_ACTIVATED
+wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxc.wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
+wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxc.wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
 wxEVT_COMMAND_TAB_SEL_CHANGED = wxc.wxEVT_COMMAND_TAB_SEL_CHANGED
 wxEVT_COMMAND_TAB_SEL_CHANGING = wxc.wxEVT_COMMAND_TAB_SEL_CHANGING
 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxc.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
@@ -754,6 +806,7 @@ wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxc.wxEVT_COMMAND_SPLITTER_SASH_POS_C
 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxc.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
 wxEVT_COMMAND_SPLITTER_UNSPLIT = wxc.wxEVT_COMMAND_SPLITTER_UNSPLIT
 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxc.wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
+wxEVT_NAVIGATION_KEY = wxc.wxEVT_NAVIGATION_KEY
 __version__ = wxc.__version__
 cvar = wxc.cvar
 wxPyDefaultPosition = wxPointPtr(wxc.cvar.wxPyDefaultPosition)
@@ -1041,6 +1094,69 @@ def EVT_COMMAND_SCROLL_PAGEDOWN(win, id, func):
 def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func):
     win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK, func)
 
+#---
+def EVT_SCROLLWIN(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP,       func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM,    func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP,    func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN,  func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP,    func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN,  func)
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK,func)
+
+def EVT_SCROLLWIN_TOP(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_TOP, func)
+
+def EVT_SCROLLWIN_BOTTOM(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM, func)
+
+def EVT_SCROLLWIN_LINEUP(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP, func)
+
+def EVT_SCROLLWIN_LINEDOWN(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
+
+def EVT_SCROLLWIN_PAGEUP(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP, func)
+
+def EVT_SCROLLWIN_PAGEDOWN(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
+
+def EVT_SCROLLWIN_THUMBTRACK(win, func):
+    win.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
+
+
+
+# Scrolling, with an id
+def EVT_COMMAND_SCROLLWIN(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_TOP,       func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM,    func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP,    func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN,  func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP,    func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN,  func)
+    win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK,func)
+
+def EVT_COMMAND_SCROLLWIN_TOP(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_TOP, func)
+
+def EVT_COMMAND_SCROLLWIN_BOTTOM(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM, func)
+
+def EVT_COMMAND_SCROLLWIN_LINEUP(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP, func)
+
+def EVT_COMMAND_SCROLLWIN_LINEDOWN(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN, func)
+
+def EVT_COMMAND_SCROLLWIN_PAGEUP(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP, func)
+
+def EVT_COMMAND_SCROLLWIN_PAGEDOWN(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN, func)
+
+def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win, id, func):
+    win.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK, func)
 
 # Convenience commands
 def EVT_BUTTON(win, id, func):
@@ -1302,6 +1418,14 @@ def EVT_LIST_INSERT_ITEM(win, id, func):
 def EVT_LIST_COL_CLICK(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
 
+def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func)
+
+def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func)
+
+
+
 #wxSplitterWindow
 def EVT_SPLITTER_SASH_POS_CHANGING(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, func)
@@ -1344,17 +1468,9 @@ wxPyDefaultPosition.Set(-1,-1)
 wxPyDefaultSize.Set(-1,-1)
 
 # aliases so that C++ documentation applies:
-wxDefaultPosition = wxPyDefaultPosition
-wxDefaultSize     = wxPyDefaultSize
-
+wxDefaultPosition  = wxPyDefaultPosition
+wxDefaultSize      = wxPyDefaultSize
 
-# This is to cover up a bug in SWIG.  We are redefining
-# the shadow class that is generated for wxAcceleratorTable
-# because SWIG incorrectly uses "arg0.this"
-class wxAcceleratorTable(wxAcceleratorTablePtr):
-    def __init__(self,arg0) :
-        self.this = miscc.new_wxAcceleratorTable(arg0)
-        self.thisown = 1
 
 #----------------------------------------------------------------------
 # This helper function will take a wxPython object and convert it to
@@ -1390,31 +1506,36 @@ def wxPyTypeCast(obj, typeStr):
 
 #----------------------------------------------------------------------
 
-##  class wxPyStdOutWindow:
-##       def __init__(self, title = "wxPython: stdout/stderr"):
-##          self.frame = None
-##          self.title = title
+class wxPyOnDemandOutputWindow:
+    def __init__(self, title = "wxPython: stdout/stderr"):
+        self.frame  = None
+        self.title  = title
+
+    def SetParent(self, parent):
+        self.parent = parent
+
+    def OnCloseWindow(self, event):
+        if self.frame != None:
+            self.frame.Destroy()
+        self.frame = None
+        self.text  = None
 
-##      def write(self, str):
-##          if not self.frame:
-##              self.frame = wxFrame(NULL, -1, self.title)
-##              self.text  = wxTextCtrl(self.frame, -1, "", wxPoint(0,0), wxDefaultSize,
-##                                      wxTE_MULTILINE|wxTE_READONLY)
-##              self.frame.SetSize(wxSize(450, 300))
-##              self.frame.Show(true)
-##              EVT_CLOSE(self.frame, self.OnCloseWindow)
-##          self.text.AppendText(str)
+    # this provides the file-like behaviour
+    def write(self, str):
+        if not self.frame:
+            self.frame = wxFrame(self.parent, -1, self.title)
+            self.text  = wxTextCtrl(self.frame, -1, "",
+                                    style = wxTE_MULTILINE|wxTE_READONLY)
+            self.frame.SetSize(wxSize(450, 300))
+            self.frame.Show(true)
+            EVT_CLOSE(self.frame, self.OnCloseWindow)
+        self.text.AppendText(str)
 
-##      def OnCloseWindow(self, event):
-##          wxBell()
-##          self.frame.Destroy()
-##          self.frame = None
-##          self.text  = None
+    def close(self):
+        self.frame = None
+        self.text  = None
 
 
-##      def close(self):
-##          if self.frame:
-##              self.frame.Close(true)
 
 _defRedirect = (wxPlatform == '__WXMSW__')
 
@@ -1424,6 +1545,7 @@ _defRedirect = (wxPlatform == '__WXMSW__')
 
 class wxApp(wxPyApp):
     error = 'wxApp.error'
+    outputWindowClass = wxPyOnDemandOutputWindow
 
     def __init__(self, redirect=_defRedirect, filename=None):
         wxPyApp.__init__(self)
@@ -1431,7 +1553,6 @@ class wxApp(wxPyApp):
         self.saveStdio = (sys.stdout, sys.stderr)
         if redirect:
             self.RedirectStdio(filename)
-
         # this initializes wxWindows and then calls our OnInit
         _wxStart(self.OnInit)
 
@@ -1442,12 +1563,22 @@ class wxApp(wxPyApp):
         except:
             pass
 
+
+    def SetTopWindow(self, frame):
+        if self.stdioWin:
+            self.stdioWin.SetParent(frame)
+            sys.stdout = self.stdioWin #sys.stderr =
+        wxPyApp.SetTopWindow(self, frame)
+
+    def MainLoop(self):
+        wxPyApp.MainLoop(self)
+        self.RestoreStdio()
+
     def RedirectStdio(self, filename):
         if filename:
             sys.stdout = sys.stderr = open(filename, 'a')
         else:
-            raise self.error, 'wxPyStdOutWindow not yet implemented.'
-            #self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow()
+            self.stdioWin = self.outputWindowClass() # wxPyOnDemandOutputWindow
 
     def RestoreStdio(self):
         sys.stdout, sys.stderr = self.saveStdio
@@ -1455,6 +1586,7 @@ class wxApp(wxPyApp):
             self.stdioWin.close()
 
 
+
 #----------------------------------------------------------------------------
 # DO NOT hold any other references to this object.  This is how we know when
 # to cleanup system resources that wxWin is holding...