guidemo.py :  » Windows » pyExcelerator » pywin32-214 » pythonwin » pywin » Demos » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Windows » pyExcelerator 
pyExcelerator » pywin32 214 » pythonwin » pywin » Demos » guidemo.py
# GUI Demo - just a worker script to invoke all the other demo/test scripts.
import win32ui
import __main__
import sys
import regutil
import win32api

demos = [ \
#  ('Font', 'import fontdemo;fontdemo.FontDemo()'),
  ('Open GL Demo', 'import openGLDemo;openGLDemo.test()'),
  ('Threaded GUI', 'import threadedgui;threadedgui.ThreadedDemo()'),
  ('Tree View Demo', 'import hiertest;hiertest.demoboth()'),
  ('3-Way Splitter Window', 'import splittst;splittst.demo()'),
  ('Custom Toolbars and Tooltips', 'import toolbar;toolbar.test()'),
  ('Progress Bar', 'import progressbar;progressbar.demo()'),
  ('Slider Control', 'import sliderdemo;sliderdemo.demo()'),
  ('Dynamic window creation', 'import createwin;createwin.demo()'),
  ('Various Dialog demos', 'import dlgtest;dlgtest.demo()'),
  ('OCX Control Demo', 'from ocx import ocxtest;ocxtest.demo()'),
  ('OCX Serial Port Demo', 'from ocx import ocxserialtest;  ocxserialtest.test()'),
  ('IE4 Control Demo', 'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")'),
]

def demo():
  try:
    # seeif I can locate the demo files.
    import fontdemo
  except ImportError:
    # else put the demos direectory on the path (if not already)
    try:
      instPath = regutil.GetRegistryDefaultValue(regutil.BuildDefaultPythonKey() + "\\InstallPath")
    except win32api.error:
      print "The InstallPath can not be located, and the Demos directory is not on the path"
      instPath="."
      
    demosDir = win32ui.FullPath(instPath + "\\Demos")
    for path in sys.path:
      if win32ui.FullPath(path)==demosDir:
        break
    else:
      sys.path.append(demosDir)
    import fontdemo

  import sys
  if "/go" in sys.argv:
    for name, cmd in demos:    
      try:
        exec cmd
      except:
        print "Demo of %s failed - %s:%s" % (cmd,sys.exc_info()[0], sys.exc_info()[1])
    return
  # Otherwise allow the user to select the demo to run

  import pywin.dialogs.list
  while 1:
    rc = pywin.dialogs.list.SelectFromLists( "Select a Demo", demos, ['Demo Title'] )
    if rc is None:
      break
    title, cmd = demos[rc]
    try:
      exec cmd
    except:
      print "Demo of %s failed - %s:%s" % (title,sys.exc_info()[0], sys.exc_info()[1])

if __name__==__main__.__name__:
  import demoutils
  if demoutils.NeedGoodGUI():
    demo()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.