The beginings of wxHtmlWindow support in the wxPython demo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d426c97e9a
commit
ec3e670f9f
@ -23,7 +23,8 @@ _treeList = [
|
||||
|
||||
('Miscellaneous Windows', ['wxGrid', 'wxSashWindow',
|
||||
'wxScrolledWindow', 'wxSplitterWindow',
|
||||
'wxStatusBar', 'wxToolBar', 'wxNotebook']),
|
||||
'wxStatusBar', 'wxToolBar', 'wxNotebook',
|
||||
'wxHtmlWindow']),
|
||||
|
||||
('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog',
|
||||
'wxSingleChoiceDialog', 'wxTextEntryDialog',
|
||||
@ -71,34 +72,42 @@ class wxPythonDemo(wxFrame):
|
||||
# Make a File menu
|
||||
self.mainmenu = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu.Append(mID, 'E&xit', 'Get the heck outta here!')
|
||||
EVT_MENU(self, mID, self.OnFileExit)
|
||||
self.mainmenu.Append(menu, '&File')
|
||||
|
||||
# Make a Demo menu
|
||||
menu = wxMenu()
|
||||
for item in _treeList:
|
||||
submenu = wxMenu()
|
||||
for childItem in item[1]:
|
||||
mID = wxNewId()
|
||||
submenu.Append(mID, childItem)
|
||||
EVT_MENU(self, mID, self.OnDemoMenu)
|
||||
menu.AppendMenu(wxNewId(), item[0], submenu)
|
||||
self.mainmenu.Append(menu, '&Demo')
|
||||
|
||||
|
||||
# Make a Help menu
|
||||
mID = NewId()
|
||||
mID = wxNewId()
|
||||
menu = wxMenu()
|
||||
menu.Append(mID, '&About', 'wxPython RULES!!!')
|
||||
EVT_MENU(self, mID, self.OnHelpAbout)
|
||||
self.mainmenu.Append(menu, '&Help')
|
||||
self.SetMenuBar(self.mainmenu)
|
||||
|
||||
selectedDemo = None
|
||||
selectedDemoName = "Nada"
|
||||
if len(sys.argv) == 2:
|
||||
selectedDemoName = sys.argv[1]
|
||||
|
||||
# Create a TreeCtrl
|
||||
tID = NewId()
|
||||
tID = wxNewId()
|
||||
self.treeMap = {}
|
||||
self.tree = wxTreeCtrl(splitter, tID)
|
||||
root = self.tree.AddRoot("Overview")
|
||||
for item in _treeList:
|
||||
child = self.tree.AppendItem(root, item[0])
|
||||
for childItem in item[1]:
|
||||
theDemo = self.tree.AppendItem(child, childItem)
|
||||
if childItem == selectedDemoName:
|
||||
selectedDemo = theDemo
|
||||
self.treeMap[childItem] = theDemo
|
||||
|
||||
self.tree.Expand(root)
|
||||
EVT_TREE_ITEM_EXPANDED (self.tree, tID, self.OnItemExpanded)
|
||||
@ -142,9 +151,16 @@ class wxPythonDemo(wxFrame):
|
||||
# select initial items
|
||||
self.nb.SetSelection(0)
|
||||
self.tree.SelectItem(root)
|
||||
if selectedDemo:
|
||||
self.tree.SelectItem(selectedDemo)
|
||||
self.tree.EnsureVisible(selectedDemo)
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
try:
|
||||
selectedDemo = self.treeMap[sys.argv[1]]
|
||||
except:
|
||||
selectedDemo = None
|
||||
if selectedDemo:
|
||||
self.tree.SelectItem(selectedDemo)
|
||||
self.tree.EnsureVisible(selectedDemo)
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
def WriteText(self, text):
|
||||
@ -242,13 +258,14 @@ class wxPythonDemo(wxFrame):
|
||||
|
||||
|
||||
def OnHelpAbout(self, event):
|
||||
about = wxMessageDialog(self,
|
||||
"wxPython is a Python extension module that\n"
|
||||
"encapsulates the wxWindows GUI classes.\n\n"
|
||||
"This demo shows off some of the capabilities\n"
|
||||
"of wxPython.\n\n"
|
||||
" Developed by Robin Dunn",
|
||||
"About wxPython", wxOK)
|
||||
#about = wxMessageDialog(self,
|
||||
# "wxPython is a Python extension module that\n"
|
||||
# "encapsulates the wxWindows GUI classes.\n\n"
|
||||
# "This demo shows off some of the capabilities\n"
|
||||
# "of wxPython.\n\n"
|
||||
# " Developed by Robin Dunn",
|
||||
# "About wxPython", wxOK)
|
||||
about = MyAboutBox(self)
|
||||
about.ShowModal()
|
||||
about.Destroy()
|
||||
|
||||
@ -266,6 +283,56 @@ class wxPythonDemo(wxFrame):
|
||||
self.window = self.otherWin
|
||||
self.otherWin = None
|
||||
|
||||
#---------------------------------------------
|
||||
def OnDemoMenu(self, event):
|
||||
print event.GetId(), self.mainmenu.GetLabel(event.GetId())
|
||||
try:
|
||||
selectedDemo = self.treeMap[self.mainmenu.GetLabel(event.GetId())]
|
||||
except:
|
||||
selectedDemo = None
|
||||
if selectedDemo:
|
||||
self.tree.SelectItem(selectedDemo)
|
||||
self.tree.EnsureVisible(selectedDemo)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyAboutBox(wxDialog):
|
||||
text = '''
|
||||
<html>
|
||||
<body bgcolor="#AC76DE">
|
||||
<center><table bgcolor="#458154" width="100%%" cellspacing="0" cellpadding="0" border="1">
|
||||
<tr>
|
||||
<td align="center"><h1>wxPython %s</h1></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><b>wxPython</b> is a Python extension module that
|
||||
encapsulates the wxWindows GUI classes.</p>
|
||||
|
||||
<p>This demo shows off some of the capabilities
|
||||
of <b>wxPython</b>. Select items from the menu or tree control,
|
||||
sit back and enjoy. Be sure to take a peek at the source code for each
|
||||
demo item so you can learn how to use the classes yourself.</p>
|
||||
|
||||
<p><b>wxPython</b> is brought to you by <b>Robin Dunn</b> and<br>
|
||||
<b>Total Control Software</b>, copyright 1999.</p>
|
||||
|
||||
<p><font size="-1">Please see <i>license.txt</i> for licensing information.</font></p>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
def __init__(self, parent):
|
||||
from wxPython.html import *
|
||||
wxDialog.__init__(self, parent, -1, 'About wxPython')
|
||||
self.html = wxHtmlWindow(self, -1, wxPoint(5,5), wxSize(400, 350))
|
||||
self.html.SetPage(self.text % wx.__version__)
|
||||
wxButton(self, wxID_OK, 'OK', wxPoint(5, 365)).SetDefault()
|
||||
self.Fit()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------
|
||||
|
20
utils/wxPython/demo/data/imagemap.htm
Normal file
20
utils/wxPython/demo/data/imagemap.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>ImageMap Test</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#FFFFFF">
|
||||
This is test.
|
||||
<img src="imagemap.png" width="269" height="249" border="0" usemap="#mymap">
|
||||
<map name="mymap">
|
||||
<area shape="poly" coords="187,85,160,121,163,153,180,129,166,225,241,223,230,155,201,121,187,86" href="test.htm">
|
||||
<area shape="circle" coords="96,89,36" href="fft.html">
|
||||
<area shape="rect" coords="43,168,124,213" href="tables.htm">
|
||||
</map>
|
||||
|
||||
|
||||
<img src="imagemap.png" usemap="#mymap">
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
utils/wxPython/demo/data/imagemap.png
Normal file
BIN
utils/wxPython/demo/data/imagemap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
utils/wxPython/demo/data/pic.png
Normal file
BIN
utils/wxPython/demo/data/pic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
utils/wxPython/demo/data/pic2.bmp
Normal file
BIN
utils/wxPython/demo/data/pic2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
116
utils/wxPython/demo/data/tables.htm
Normal file
116
utils/wxPython/demo/data/tables.htm
Normal file
@ -0,0 +1,116 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686) [Netscape]">
|
||||
</HEAD>
|
||||
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
|
||||
|
||||
<H3>
|
||||
This is TABLES
|
||||
tests page...</H3>
|
||||
|
||||
|
||||
(yes, really, see bellow:)
|
||||
<BR>Click <a href="test.htm">here</a> to go to original testing page...
|
||||
<BR>Click <a href="../../docs/html/man.htm">here</a> to go to manuals...
|
||||
<BR>
|
||||
<CENTER><TABLE CELLSPACING=5 BORDER COLS=2 WIDTH="40%" NOSAVE >
|
||||
<TR ALIGN=CENTER NOSAVE>
|
||||
<TD WIDTH="40%" NOSAVE>Top left
|
||||
<BR>(two lines expression)
|
||||
<P>paragraph done</TD>
|
||||
|
||||
<TD NOSAVE>Top right</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD>Bottom left</TD>
|
||||
|
||||
<TD>Bottom right</TD>
|
||||
</TR>
|
||||
</TABLE></CENTER>
|
||||
|
||||
<P>Subsampling is shown there:
|
||||
<BR>
|
||||
<TABLE BORDER COLS=2 WIDTH="100%" NOSAVE >
|
||||
<TR NOSAVE>
|
||||
<TD VALIGN=BOTTOM NOSAVE>
|
||||
<TABLE BORDER COLS=2 WIDTH="50%" NOSAVE >
|
||||
<TR ALIGN=CENTER BGCOLOR="#3366FF" NOSAVE>
|
||||
<TD>a</TD>
|
||||
|
||||
<TD WIDTH="10%" NOSAVE>b</TD>
|
||||
</TR>
|
||||
|
||||
<TR NOSAVE>
|
||||
<TD>c</TD>
|
||||
|
||||
<TD NOSAVE>d</TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
</TD>
|
||||
|
||||
<TD VALIGN=BOTTOM NOSAVE>2</TD>
|
||||
</TR>
|
||||
|
||||
<TR NOSAVE>
|
||||
<TD>3 dflkj lkjfl dkjldkfjl flk jflkf lkjflkj ljlf ajlfj alff h khg hgj
|
||||
gjg jg gjhfg fg gjh gjf jgf jgj f gjfgj kfajg </TD>
|
||||
|
||||
<TD ALIGN=CENTER VALIGN=BOTTOM BGCOLOR="#FFFF99" NOSAVE>4
|
||||
<BR>gh
|
||||
<BR>gfh
|
||||
<BR>gh
|
||||
<BR>hg
|
||||
<BR>5</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P>This is "default" table - with no sizes givev:
|
||||
<BR>
|
||||
<TABLE BORDER COLS=4 WIDTH="100%" NOSAVE >
|
||||
<TR NOSAVE>
|
||||
<TD>Hello</TD>
|
||||
|
||||
<TD NOSAVE>lkfdsjlk fj dlfj lkfj lkjflk jlfk lk fjlk elwkf lkejflek f jlekjflkj
|
||||
ljlk lk jlkf lefjl j flkj ljl lf lfj lfjl lj lwe lekf;eh kfejh lkh kjh
|
||||
kjhkj hkj hkj lkh kjh kjlh kj</TD>
|
||||
|
||||
<TD>shortebn formo lr lk</TD>
|
||||
|
||||
<TD>djsf lkjlf poer oi pjr po kpk </TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD>a</TD>
|
||||
|
||||
<TD>b</TD>
|
||||
|
||||
<TD>c</TD>
|
||||
|
||||
<TD>d</TD>
|
||||
</TR>
|
||||
|
||||
<TR NOSAVE>
|
||||
<TD>1</TD>
|
||||
|
||||
<TD>2</TD>
|
||||
|
||||
<TD COLSPAN="2" ROWSPAN="2" NOSAVE>3</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD>A</TD>
|
||||
|
||||
<TD>B</Td>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
248
utils/wxPython/demo/data/test.htm
Normal file
248
utils/wxPython/demo/data/test.htm
Normal file
@ -0,0 +1,248 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux
|
||||
2.0.35 i686) [Netscape]">
|
||||
<TITLE>wxHTML Test</TITLE>
|
||||
</HEAD>
|
||||
<BODY TEXT="#000000" BGCOLOR="#006600" LINK="#0000FF" VLINK="#FF0000" ALINK="#000088">
|
||||
|
||||
<b><a href="tables.htm">click here to go to tables test page!</a></b>
|
||||
<p>
|
||||
<b><a href="imagemap.htm">click here to go to IMAGEMAPs test page!</a></b>
|
||||
|
||||
<p>
|
||||
This is - - default text, now switching to
|
||||
<CENTER>
|
||||
<P>center, now still ctr, now exiting</CENTER>
|
||||
exited!.<A HREF="#downtown">[link to down]</A>
|
||||
<P>Hello, this *is* default charset (helvetica, probably) and it is displayed
|
||||
with one <FONT COLOR="#FF0000">COLOR CHANGE</FONT>. Of course we
|
||||
can have as many color changes as we can, what about this <FONT COLOR="#FF0000">M</FONT><FONT COLOR="#FFFF00">A</FONT><FONT COLOR="#33FF33">D</FONT><B><FONT COLOR="#FFFFFF"><FONT SIZE=+1>N</FONT></FONT></B>E<FONT COLOR="#999999">S</FONT><FONT COLOR="#CC33CC">S?</FONT>
|
||||
<P><FONT COLOR="#000000">There was a space above.</FONT>
|
||||
<BR>
|
||||
<HR WIDTH="100%">This was a line. <TT>(BTW we are in <B>fixed</B> font
|
||||
/ <I><U>typewriter</U> font</I> right now :-)</TT>
|
||||
<BR>This is in <B>BOLD</B> face. This is <I>ITALIC.</I> This is <B><I><U>E
|
||||
V E R Y T H I N G</U></I></B>.
|
||||
<BR>
|
||||
<P><BR>
|
||||
<CENTER>
|
||||
<P>Right now, <FONT COLOR="#0000FF"><FONT SIZE=+4>centered REALLY Big Text</FONT></FONT>,
|
||||
how do you like (space) it?</CENTER>
|
||||
|
||||
<DIV ALIGN=right>RIGHT: <FONT SIZE=-2>text-2, </FONT><FONT SIZE=-1>text-1,
|
||||
</FONT>text+0,
|
||||
<FONT SIZE=+1>text+1,
|
||||
</FONT><FONT COLOR="#FF0000"><FONT SIZE=+2>text+2,
|
||||
</FONT></FONT><FONT SIZE=+3>text+3,
|
||||
</FONT><FONT SIZE=+4>text+4</FONT>
|
||||
<BR><U><FONT SIZE=+1>we are right now</FONT></U></DIV>
|
||||
|
||||
<CENTER><U><FONT SIZE=+1>we are center now</FONT></U></CENTER>
|
||||
<U><FONT SIZE=+1>we are left now.</FONT></U>
|
||||
<P><I><FONT COLOR="#3366FF">Blue italic text is displayed there....</FONT></I>
|
||||
<H1>
|
||||
|
||||
<HR ALIGN=LEFT SIZE=10 WIDTH="50%">This is heading one.</H1>
|
||||
this is normal
|
||||
<CENTER>
|
||||
<H1>
|
||||
This is <FONT COLOR="#33FF33">CENTERED</FONT> heading one</H1></CENTER>
|
||||
<FONT COLOR="#FFFF00">Yes, hmmmmmmmmm........, right now, <TT>we should
|
||||
display some tiny nice image</TT>, he?</FONT>
|
||||
<BR><IMG SRC="pic.png" ALT="Testing image image" ><IMG SRC="pic2.bmp">and this is text......
|
||||
<P><IMG SRC="pic.png" ALT="Testing image image" HEIGHT=200 WIDTH=327 ALIGN=CENTER>and
|
||||
this is text......
|
||||
<BR><A HREF="pic.png"><IMG SRC="pic.png" ALT="Testing image image" HEIGHT=160 WIDTH=100 ALIGN=TEXTTOP></A> (try clicking on the image :-) and
|
||||
this is text......
|
||||
<BR>
|
||||
<BR>
|
||||
<UL>
|
||||
<LI>
|
||||
item 1</LI>
|
||||
|
||||
<LI>
|
||||
item 2</LI>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
nested item</LI>
|
||||
|
||||
<LI>
|
||||
nested item 2</LI>
|
||||
</UL>
|
||||
|
||||
<LI>
|
||||
item 3</LI>
|
||||
</UL>
|
||||
|
||||
<OL>
|
||||
<LI>
|
||||
item one</LI>
|
||||
|
||||
<LI>
|
||||
item two</LI>
|
||||
|
||||
<OL>
|
||||
<LI>
|
||||
nsted item</LI>
|
||||
</OL>
|
||||
|
||||
<LI>
|
||||
last numbered item</LI>
|
||||
</OL>
|
||||
|
||||
<H1>
|
||||
Heading 1</H1>
|
||||
<I>Italic text now...</I>
|
||||
<H2>
|
||||
<I>Heading 2</I></H2>
|
||||
<I>and now?</I>
|
||||
<H3>
|
||||
Heading 3</H3>
|
||||
|
||||
<H4>
|
||||
Heading 4</H4>
|
||||
|
||||
<H5>
|
||||
Heading 5</H5>
|
||||
|
||||
<H6>
|
||||
Heading 6</H6>
|
||||
And this is normal text, once again :-)
|
||||
<BR>
|
||||
<BR>
|
||||
<BR>
|
||||
<BR>
|
||||
<BR>
|
||||
<BR>
|
||||
<P>And yes, we're in <FONT SIZE=+4>HTML DOCUMENT</FONT>
|
||||
<P>hello?
|
||||
<BR>
|
||||
<P><BR>
|
||||
<CENTER>
|
||||
<P>This is <A NAME="downtown"></a>centered paragraph</CENTER>
|
||||
|
||||
<P>This is new par?
|
||||
<P><B>We switched to BOLD</B>
|
||||
<P><B>This is new paragraph</B> Bold is off now.
|
||||
<P>new par
|
||||
<P> -----------
|
||||
<P><FONT SIZE=-2>Hello</FONT>
|
||||
<OL><FONT SIZE=-2>this is standalone :-)</FONT>
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
|
||||
jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
|
||||
fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
|
||||
kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO</FONT></LI>
|
||||
|
||||
<BLOCKQUOTE><FONT SIZE=+0><B>(blockquote)</B>two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO</FONT>
|
||||
<BLOCKQUOTE><FONT SIZE=+0>two two two two two two twotwo TWO two two two</FONT></BLOCKQUOTE>
|
||||
<FONT SIZE=+0>two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO</FONT></BLOCKQUOTE>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO</FONT>
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
|
||||
jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
|
||||
fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
|
||||
kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO two two two two two two twotwo TWO two
|
||||
two two two two two twotwo TWO two two two two two two twotwo TWO two two
|
||||
two two two two twotwo TWO two two two two two two twotwo TWO two two two
|
||||
two two two twotwo TWO two two two two two two twotwo TWO two two two two
|
||||
two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
|
||||
jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
|
||||
fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
|
||||
kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO two two two two two two twotwo TWO two
|
||||
two two two two two twotwo TWO two two two two two two twotwo TWO two two
|
||||
two two two two twotwo TWO two two two two two two twotwo TWO two two two
|
||||
two two two twotwo TWO two two two two two two twotwo TWO two two two two
|
||||
two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
|
||||
jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
|
||||
fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
|
||||
kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO two two two two two two twotwo TWO two
|
||||
two two two two two twotwo TWO two two two two two two twotwo TWO two two
|
||||
two two two two twotwo TWO two two two two two two twotwo TWO two two two
|
||||
two two two twotwo TWO two two two two two two twotwo TWO two two two two
|
||||
two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item number one. iti lkdjfdl kjd lk jlkjdl kjlk jlf
|
||||
jflkj d lfkjlkf jl jflkj flkwe lkhelf ;fk;fl kw;lfke ;ffj lkjflk wj lfjl
|
||||
fkw ;k;ekf;lkfe ;kf;lk; ;j ;lrj;wfj;f ;eljfw; lfj;ewlfj dagdja gdj chga
|
||||
kjegiquw iuqdb qiud iquwd hurray googoo.</FONT></LI>
|
||||
|
||||
<LI>
|
||||
<FONT SIZE=-2>two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO two two two two two two twotwo TWO two two two two two two twotwo
|
||||
TWO two two two two two two twotwo TWO two two two two two two twotwo TWO
|
||||
two two two two two two twotwo TWO two two two two two two twotwo TWO</FONT></LI>
|
||||
|
||||
<P><BR><FONT SIZE=-2>two two two two two two twotwo TWO two two two two
|
||||
two two twotwo TWO two two two two two two twotwo TWO two two two two two
|
||||
two twotwo TWO</FONT>
|
||||
<P><FONT SIZE=-2>two two two two two two twotwo TWO two two two two two
|
||||
two twotwo TWO two two two two two two twotwo TWO two two two two two two
|
||||
twotwo TWO</FONT>
|
||||
<LI>
|
||||
<FONT SIZE=-2>This is item nyumber 3.</FONT></LI>
|
||||
</OL>
|
||||
Now, you will see some PRE text:<p>
|
||||
<PRE>// This is sample C++ code:
|
||||
|
||||
void main(int argc, char *argv[])
|
||||
{
|
||||
printf("Go away, man!\n");
|
||||
i = 666;
|
||||
printf("\n\n\nCRASH\n DOWN NOW. . . \n");
|
||||
}</PRE>
|
||||
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
106
utils/wxPython/demo/wxHtmlWindow.py
Normal file
106
utils/wxPython/demo/wxHtmlWindow.py
Normal file
@ -0,0 +1,106 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
from wxPython.lib.sizers import *
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# This shows how to catch the OnLinkClicked non-event. (It's a virtual
|
||||
# method in the C++ code...)
|
||||
class MyHtmlWindow(wxHtmlWindow):
|
||||
def __init__(self, parent, id, log):
|
||||
wxHtmlWindow.__init__(self, parent, id)
|
||||
self.log = log
|
||||
|
||||
def OnLinkClicked(self, link):
|
||||
self.log.WriteText('OnLinkClicked: %s\n' % link)
|
||||
|
||||
# Virtuals in the base class have been renamed with base_ on the font.
|
||||
self.base_OnLinkClicked(link)
|
||||
|
||||
|
||||
|
||||
class TestHtmlPanel(wxPanel):
|
||||
def __init__(self, parent, frame, log):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
self.frame = frame
|
||||
|
||||
|
||||
self.html = MyHtmlWindow(self, -1, log)
|
||||
self.html.SetRelatedFrame(frame, "wxPython: (A Demonstration) -- %s")
|
||||
self.html.SetRelatedStatusBar(0)
|
||||
|
||||
self.box = box.wxBoxSizer(wxVERTICAL)
|
||||
self.box.Add(self.html, 1)
|
||||
|
||||
subbox = wxBoxSizer(wxHORIZONTAL)
|
||||
btn = wxButton(self, 1201, "Show Default")
|
||||
EVT_BUTTON(self, 1201, self.OnShowDefault)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1202, "Load File")
|
||||
EVT_BUTTON(self, 1202, self.OnLoadFile)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1203, "With Widgets")
|
||||
EVT_BUTTON(self, 1203, self.OnWithWidgets)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1204, "Back")
|
||||
EVT_BUTTON(self, 1204, self.OnBack)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1205, "Forward")
|
||||
EVT_BUTTON(self, 1205, self.OnForward)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
self.box.Add(subbox)
|
||||
self.OnShowDefault(None)
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
size = self.GetClientSize()
|
||||
self.box.Layout(size)
|
||||
|
||||
|
||||
def OnShowDefault(self, event):
|
||||
self.html.LoadPage("data/test.htm")
|
||||
|
||||
|
||||
def OnLoadFile(self, event):
|
||||
pass
|
||||
|
||||
|
||||
def OnWithWidgets(self, event):
|
||||
pass
|
||||
|
||||
def OnBack(self, event):
|
||||
if not self.html.HistoryBack():
|
||||
wxMessageBox("No more items in history!")
|
||||
|
||||
def OnForward(self, event):
|
||||
if not self.html.HistoryForward():
|
||||
wxMessageBox("No more items in history!")
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestHtmlPanel(nb, frame, log)
|
||||
return win
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
wxHtmlWindow is capable of parsing and rendering most simple HTML tags.
|
||||
|
||||
It is not intended to be a high-end HTML browser. If you're looking for something like that try http://www.mozilla.org - there's a chance you'll be able to make their widget wxWindows-compatible. I'm sure everyone will enjoy your work in that case...
|
||||
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user