tiny puzzles

I'm using wx.StyledTextCtrl with the current wxPython on Mac 10.3.5. In most of my little apps the code at the bottom includes:
  app = wx.PySimpleApp()
  f = MyFrame(NULL, -1, "A Title")
Two nagging little questions: (1) is there documentation on PySimpleApp anywhere? I can't find it in the Demo or the wxDocsViewer docs. (2) to use 'NULL' in the constructor for my Frame (no parent), I must include the line
  from wx.Python.wx import *
even though I've already got
  import wx
at the top of the file. Why?

I'm using wx.StyledTextCtrl with the current wxPython on Mac 10.3.5. In
most of my little apps the code at the bottom includes:
        app = wx.PySimpleApp()
        f = MyFrame(NULL, -1, "A Title")
Two nagging little questions:
(1) is there documentation on PySimpleApp anywhere? I can't find it

in the Demo

or the wxDocsViewer docs.

PySimpleApp is a convenience class for when you don't need your own
full-featured wx.App subclass.

(2) to use 'NULL' in the constructor for my Frame (no parent), I must include
the line
        from wx.Python.wx import *
even though I've already got
        import wx
at the top of the file. Why?

Use None instead of NULL.

···

On Sun, 3 Oct 2004 17:14:31 -0400, Charles Hartman <cohar@conncoll.edu> wrote:

wx.PySimpleApp used to be a convenience class that initialised the imagehandlers, so you don't have to do it yourself via wx.InitAllImageHandlers().
In the latest 2.5 series the handlers are initialised by default so the class is basicaly the same as wx.App(), and if I'm not mistaken wx.InitAllImageHandlers() is an empty method kept just for the sake of compatibility.

A lot of classes from old wxpython got replaced by python objects, some of them can still be accessed via the new wx namespace, some were removed (like NULL)
Instead of NULL use pythons's None also... instead of wx.Size and wx.Point you can use simple python tuples.
Read the Migration Guide from the docs dir for more information on this.

···

On Sun, 3 Oct 2004 17:14:31 -0400, Charles Hartman <cohar@conncoll.edu> wrote:

I'm using wx.StyledTextCtrl with the current wxPython on Mac 10.3.5. In most of my little apps the code at the bottom includes:
  app = wx.PySimpleApp()
  f = MyFrame(NULL, -1, "A Title")
Two nagging little questions: (1) is there documentation on PySimpleApp anywhere? I can't find it in the Demo or the wxDocsViewer docs. (2) to use 'NULL' in the constructor for my Frame (no parent), I must include the line
  from wx.Python.wx import *
even though I've already got
  import wx
at the top of the file. Why?

--
Peter Damoc
Hacker Wannabe

Charles Hartman wrote:

I'm using wx.StyledTextCtrl with the current wxPython on Mac 10.3.5. In most of my little apps the code at the bottom includes:
    app = wx.PySimpleApp()
    f = MyFrame(NULL, -1, "A Title")
Two nagging little questions: (1) is there documentation on PySimpleApp anywhere? I can't find it in the Demo or the wxDocsViewer docs.

% pydoc wx.PySimpleApp
Help on class PySimpleApp in wx:

wx.PySimpleApp = class PySimpleApp(App)
  > A simple application class. You can just create one of these and
  > then then make your top level windows later, and not have to worry
  > about OnInit. For example::
  >
  > app = wx.PySimpleApp()
  > frame = wx.Frame(None, title='Hello World')
  > frame.Show()
  > app.MainLoop()
  >
  > :see: `wx.App`

(2) to use 'NULL' in the constructor for my Frame (no parent), I must include the line
    from wx.Python.wx import *
even though I've already got
    import wx
at the top of the file. Why?

NULL is a leftover from when SWIG didn't automatically convert Python's None <--> C's NULL. It has just been an alias for None for many years now and so it got culled in the code cleansing that took place for 2.5. As other foks have mentioned, just use None instead.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!