]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/py/PyWrap.py
Use the system settings for the selection colours
[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
d40bbd4d
PB
8import wx
9from wx import py
10
d14a1e28
RD
11import os
12import sys
d14a1e28
RD
13
14def wrap(app):
15 wx.InitAllImageHandlers()
d40bbd4d 16 frame = py.crust.CrustFrame()
d14a1e28
RD
17 frame.SetSize((750, 525))
18 frame.Show(True)
19 frame.shell.interp.locals['app'] = app
20 app.MainLoop()
21
d14a1e28
RD
22def main(modulename=None):
23 sys.path.insert(0, os.curdir)
24 if not modulename:
25 if len(sys.argv) < 2:
26 print "Please specify a module name."
27 raise SystemExit
28 modulename = sys.argv[1]
29 if modulename.endswith('.py'):
30 modulename = modulename[:-3]
31 module = __import__(modulename)
32 # Find the App class.
33 App = None
34 d = module.__dict__
35 for item in d.keys():
36 try:
37 if issubclass(d[item], wx.App):
38 App = d[item]
39 except (NameError, TypeError):
40 pass
41 if App is None:
578b389d 42 print "No App class was found."
d14a1e28
RD
43 raise SystemExit
44 app = App()
45 wrap(app)
1fded56b 46
8b9a4190
RD
47if __name__ == '__main__':
48 main()