If you do the same thing in the PyCrust python shell
(PyCrust download | SourceForge.net) you get command auto-completion
whenever you type a dot (such as "app.") that pops up a list of all the
attributes for that object. PyCrust also has a namespace tree view that lets
you drill down through all objects in the local namespace. And you can do
all this while your app is running. Here is a sample session showing some of
the things you can do, including calling the getAutoCompleteList() function
directly to answer your question about what other attributes app and frame
have:
Welcome To PyCrust 0.6.1 - The Flakiest Python Shell
Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
Startup script executed: C:\Code\.pythonrc.py
from wxPython.wx import wxPySimpleApp, wxFrame
app = wxPySimpleApp()
frame = wxFrame(None, -1, "Hello World")
frame.Show(1)
1
dir(app)
['saveStdio', 'stdioWin', 'this', 'thisown']
app.MainLoop()
app.GetAppName()
''
app.SetAppName('My App')
app.GetAppName()
'My App'
frame.GetTitle()
'Hello World'
frame.SetTitle('Goodbye World')
frame.GetTitle()
'Goodbye World'
pprint(shell.interp.getAutoCompleteList('app'))
['AddPendingEvent',
'Connect',
'Destroy',
'Disconnect',
'Dispatch',
'ExitMainLoop',
'GetAppName',
'GetAuto3D',
'GetClassName',
'GetEvtHandlerEnabled',
'GetExitOnFrameDelete',
'GetNextHandler',
'GetPreviousHandler',
'GetPrintMode',
'GetStdIcon',
'GetTopWindow',
'GetUseBestVisual',
'GetVendorName',
'Initialized',
'MainLoop',
'OnInit',
'Pending',
'ProcessEvent',
'ProcessIdle',
'RedirectStdio',
'RestoreStdio',
'SetAppName',
'SetAuto3D',
'SetClassName',
'SetEvtHandlerEnabled',
'SetExitOnFrameDelete',
'SetNextHandler',
'SetPreviousHandler',
'SetPrintMode',
'SetTopWindow',
'SetUseBestVisual',
'SetVendorName',
'__del__',
'__doc__',
'__init__',
'__module__',
'__repr__',
'error',
'outputWindowClass',
'saveStdio',
'stdioWin',
'this',
'thisown']
pprint(shell.interp.getAutoCompleteList('frame'))
['AcceptsFocus',
'AddPendingEvent',
'CaptureMouse',
'Center',
'CenterOnParent',
'CenterOnScreen',
'Centre',
'CentreOnParent',
'CentreOnScreen',
'Clear',
'ClientToScreen',
'ClientToScreenXY',
'Close',
'Command',
'Connect',
'ConvertDialogPointToPixels',
'ConvertDialogSizeToPixels',
'ConvertPixelPointToDialog',
'ConvertPixelSizeToDialog',
'Create',
'CreateStatusBar',
'CreateToolBar',
'DLG_PNT',
'DLG_SZE',
'Destroy',
'DestroyChildren',
'Disconnect',
'DragAcceptFiles',
'Enable',
'FindWindowById',
'FindWindowByName',
'Fit',
'Freeze',
'GetAutoLayout',
'GetBackgroundColour',
'GetBestSize',
'GetCaret',
'GetCharHeight',
'GetCharWidth',
'GetChildren',
'GetClassName',
'GetClientAreaOrigin',
'GetClientSize',
'GetClientSizeTuple',
'GetConstraints',
'GetDropTarget',
'GetEventHandler',
'GetEvtHandlerEnabled',
'GetFont',
'GetForegroundColour',
'GetFullTextExtent',
'GetGrandParent',
'GetHandle',
'GetHelpText',
'GetIcon',
'GetId',
'GetLabel',
'GetMenuBar',
'GetName',
'GetNextHandler',
'GetParent',
'GetPosition',
'GetPositionTuple',
'GetPreviousHandler',
'GetRect',
'GetScrollPos',
'GetScrollRange',
'GetScrollThumb',
'GetSize',
'GetSizeTuple',
'GetSizer',
'GetStatusBar',
'GetTextExtent',
'GetTitle',
'GetToolBar',
'GetToolTip',
'GetUpdateRegion',
'GetValidator',
'GetWindowStyleFlag',
'Hide',
'Iconize',
'InitDialog',
'IsBeingDeleted',
'IsEnabled',
'IsExposed',
'IsExposedPoint',
'IsExposedRect',
'IsFullScreen',
'IsIconized',
'IsMaximized',
'IsRetained',
'IsShown',
'IsTopLevel',
'Layout',
'LineDown',
'LineUp',
'LoadFromResource',
'Lower',
'MakeModal',
'Maximize',
'Move',
'MoveXY',
'PageDown',
'PageUp',
'PopEventHandler',
'PopupMenu',
'PopupMenuXY',
'ProcessCommand',
'ProcessEvent',
'PushEventHandler',
'Raise',
'Refresh',
'RefreshRect',
'ReleaseMouse',
'RemoveChild',
'Reparent',
'Restore',
'ScreenToClient',
'ScreenToClientXY',
'ScrollLines',
'ScrollPages',
'ScrollWindow',
'SetAcceleratorTable',
'SetAutoLayout',
'SetBackgroundColour',
'SetCaret',
'SetClientSize',
'SetClientSizeWH',
'SetConstraints',
'SetCursor',
'SetDimensions',
'SetDropTarget',
'SetEventHandler',
'SetEvtHandlerEnabled',
'SetExtraStyle',
'SetFocus',
'SetFont',
'SetForegroundColour',
'SetHelpText',
'SetIcon',
'SetId',
'SetLabel',
'SetMenuBar',
'SetName',
'SetNextHandler',
'SetPosition',
'SetPreviousHandler',
'SetRect',
'SetScrollPos',
'SetScrollbar',
'SetSize',
'SetSizeHints',
'SetSizer',
'SetStatusBar',
'SetStatusText',
'SetStatusWidths',
'SetTitle',
'SetToolBar',
'SetToolTip',
'SetToolTipString',
'SetValidator',
'SetWindowStyle',
'SetWindowStyleFlag',
'Show',
'ShowFullScreen',
'Thaw',
'TransferDataFromWindow',
'TransferDataToWindow',
'UnsetConstraints',
'Update',
'Validate',
'WarpPointer',
'__doc__',
'__init__',
'__module__',
'__repr__',
'this',
'thisown']
···
---
Patrick K. O'Brien
Orbtech (http://www.orbtech.com)
"I am, therefore I think."
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Patrick
Callahan
Sent: Friday, September 28, 2001 8:12 AM
To: wxpython-users@lists.wxwindows.org
Subject: [wxPython] a simple wxPython example and a few questions about
wxPython objects
Here's a simple wxPython example and a few questions about wxPython objects.
I chose a simple example, so the questions are about a wxFrame object,
although the kind of answers I'm seeking would apply to any UI object.
#The following bit of code from the wxPython tutorial creates a simple empty
#window with a title.
from wxPython.wx import wxPySimpleApp, wxFrame
app = wxPySimpleApp()
frame = wxFrame(None, -1, "Hello World")
frame.Show(1)
app.MainLoop()
The questions:
In the example above, what do we call the following items?
o frame
o frame.this
o frame.thisown
o '_1017b700_wxFrame_p'
o <C wxFrame instance at _1017b700_wxFrame_p>
o C wxFrame instance
What are the relationships between these things and the gui elements we see
on the display? What's in the chain of data objects between say "frame" and
what we see on the display? Is there a way to get at the contents of these
data objects from python?
Do all wxPython objects have a this and a thisown? What are they for?
Which of these things must continue to exist so the gui elements to continue
to operate?
These items were found by looking at the gui element object from python. Is
there a way to see more? Is there another way to look at it?
-Pat Callahan
Acton Ma
P.S. The list of things to question was found in the following interactive
python session:
When I use dir() on the two python objects created above, I see a
few things
that themselves have empty dictionaries.
>>> app = wxPySimpleApp()
>>> dir (app)
['saveStdio', 'stdioWin', 'this', 'thisown']
>>> dir (frame)
['this', 'thisown']
>>> dir (frame.this)
>>> dir (frame.thisown)
The actual values of the items in frame:
>>> frame
<C wxFrame instance at _1017b700_wxFrame_p>
>>> frame.this
'_1017b700_wxFrame_p'
>>> frame.thisown
1
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users