]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/py/PyWrap.py
Commented out WM_MOUSELEAVE until it can be fixed
[wxWidgets.git] / wxPython / wx / py / PyWrap.py
CommitLineData
d14a1e28
RD
1"""PyWrap is a command line utility that runs a wxPython program with
2additional runtime-tools, such as PyCrust."""
1fded56b 3
d14a1e28
RD
4__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
5__cvsid__ = "$Id$"
6__revision__ = "$Revision$"[11:-2]
7
8import os
9import sys
10import wx
11from crust import CrustFrame as Frame
12
13try:
14 True
15except NameError:
16 True = 1==1
17 False = 1==0
18
19
20def wrap(app):
21 wx.InitAllImageHandlers()
22 frame = Frame()
23 frame.SetSize((750, 525))
24 frame.Show(True)
25 frame.shell.interp.locals['app'] = app
26 app.MainLoop()
27
28
29def main(modulename=None):
30 sys.path.insert(0, os.curdir)
31 if not modulename:
32 if len(sys.argv) < 2:
33 print "Please specify a module name."
34 raise SystemExit
35 modulename = sys.argv[1]
36 if modulename.endswith('.py'):
37 modulename = modulename[:-3]
38 module = __import__(modulename)
39 # Find the App class.
40 App = None
41 d = module.__dict__
42 for item in d.keys():
43 try:
44 if issubclass(d[item], wx.App):
45 App = d[item]
46 except (NameError, TypeError):
47 pass
48 if App is None:
49 print "No App class found."
50 raise SystemExit
51 app = App()
52 wrap(app)
1fded56b 53
8b9a4190
RD
54
55if __name__ == '__main__':
56 main()