thtml.py :  » GUI » pyui » pyui095 » tests » sandbox » 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 » GUI » pyui 
pyui » pyui095 » tests » sandbox » thtml.py
import testopt
import time
import pyui


text ="""

<HTML>

<HEAD>
  <TITLE> PyUI HTML Panel Test </TITLE>
</HEAD>

<BODY bgColor="#ffffd0" text="#000000">

<H1 color=#ff0000> PyUI HTML Test </H1>

<p>Some regular &quot; text in a normal font here. This should be
<b>bold</b> but the rest of this should be normal text.</p>

<img src="max.bmp"> <b>some text here <i>between the two images<img src="max.bmp" width=50 height=50>

<h2> Heading Two </h2>
</i>
<p color="#000055">Menus are instances of the class widgets.Menu. They have menu
items added to them with the addItem() method. The addItem method
takes a title, a <a href="http://www.news.com">handler method</a> and possibly a sub-menu. The <a>handler
method will be called with the menuItem instance as the argument.
The sub-menu <font color="#bb0000" face="arial" >argument can be used to add</font> sub-menu </a>to the menu
allowing hierarchies of menus.</p>

<pre>
Pre-formatted text:

class PyuiHTMLParser(HTMLParser):

    def __init__(self, &quot;panel&quot;):
        self.panel = panel
        
    def handle_starttag(self, &quot;tag&quot;, attrs):
        self.panel.handle_starttag(tag, attrs)

</pre>

<p> Below is a list of elements</p>
<OL>
  <li> List item 1 </li>
  <li> List item 2 </li>
  <li> List item 3 </li>
  <li> List item 4 </li>  
  <li> A very long List item goes here. </li>
</OL>

<p> Below is a horizontal line </p>
<HR>

<p color=#00ff00>Menus are instances of the class widgets.Menu. They have menu
items added to them with the addItem() method. The addItem method
takes a title, a handler method and possibly a sub-menu. The handler
method will be called with the menuItem instance as the argument.
The sub-menu argument can be used to add sub-menu to the menu
allowing hierarchies of menus.</p>

<img src="max.bmp" width=400 height=100>

<p>Menus are instances of the class widgets.Menu. They have menu
items added to them with the addItem() method. The addItem method
takes a title, a handler method and possibly a sub-menu. The handler
method will be called with the menuItem instance as the argument.
The sub-menu argument can be used to add sub-menu to the menu
allowing hierarchies of menus.</p>

<p>Menus are instances of the class widgets.Menu. They have menu
items added to them with the addItem() method. The addItem method
takes a title, a handler method and possibly a sub-menu. The handler
method will be called with the menuItem instance as the argument.
The sub-menu argument can be used to add sub-menu to the menu
allowing hierarchies of menus.</p>

<HR>

<p> Bottom of the page </p>

</BODY>
</HTML>
"""
def onbutton(self):
    print "got a button " 
    
def run():
    opts = testopt.parseCommandLine(1024, 768)
    done = 1
    frame = 0
    t = time.time()
    pyui.init(*opts)
    w = pyui.widgets.Frame(0,0,800,600, "HTML!")
    h = pyui.html.HTMLPanel()
    w.replacePanel(h)
    w.pack()

    #f = open('C:/ninja/Projects/pyui/website/index.html')
    #text = f.read()
    #f.close()
    h.feed(text)
    
    #h.feed(testText)

    w.resize(800,600)
    pyui.run()

    print "done"
    pyui.quit()


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