]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/ContextHelp.py
2 from wxPython
. wx
import *
3 from wxPython
. help import *
5 #----------------------------------------------------------------------
6 # We first have to set an application-wide help provider. Normally you
7 # would do this in your app's OnInit or in other startup code...
9 provider
= wxSimpleHelpProvider ()
10 wxHelpProvider_Set ( provider
)
13 class TestPanel ( wxPanel
):
14 def __init__ ( self
, parent
, log
):
15 wxPanel
.__ init
__ ( self
, parent
, - 1 )
18 self
. SetHelpText ( "This is a wxPanel." )
19 sizer
= wxBoxSizer ( wxVERTICAL
)
21 cBtn
= wxContextHelpButton ( self
)
22 cBtn
. SetHelpText ( "wxContextHelpButton" )
23 cBtnText
= wxStaticText ( self
, - 1 , "This is a wxContextHelpButton. Clicking it puts the \n "
24 "app into context sensitive help mode." )
25 cBtnText
. SetHelpText ( "Some helpful text..." )
27 s
= wxBoxSizer ( wxHORIZONTAL
)
28 s
. Add ( cBtn
, 0 , wxALL
, 5 )
29 s
. Add ( cBtnText
, 0 , wxALL
, 5 )
33 text
= wxTextCtrl ( self
, - 1 , "Each sub-window can have its own help message" ,
34 size
=( 240 , 60 ), style
= wxTE_MULTILINE
)
35 text
. SetHelpText ( "This is my very own help message. This is a really long long long long long long long long long long long long long long long long long long long long message!" )
39 text
= wxTextCtrl ( self
, - 1 , "You can also intercept the help event if you like. Watch the log window when you click here..." ,
40 size
=( 240 , 60 ), style
= wxTE_MULTILINE
)
41 text
. SetHelpText ( "Yet another context help message." )
44 EVT_HELP ( text
, text
. GetId (), self
. OnCtxHelp
)
46 text
= wxTextCtrl ( self
, - 1 , "This one displays the tip itself..." ,
47 size
=( 240 , 60 ), style
= wxTE_MULTILINE
)
50 EVT_HELP ( text
, text
. GetId (), self
. OnCtxHelp2
)
53 border
= wxBoxSizer ( wxVERTICAL
)
54 border
. Add ( sizer
, 0 , wxALL
, 25 )
56 self
. SetAutoLayout ( true
)
61 def OnCtxHelp ( self
, evt
):
62 self
. log
. write ( "OnCtxHelp: %s " % evt
)
66 def OnCtxHelp2 ( self
, evt
):
67 self
. log
. write ( "OnCtxHelp: %s \n " % evt
)
68 tip
= wxTipWindow ( self
, "This is a wxTipWindow" )
71 #----------------------------------------------------------------------
73 def runTest ( frame
, nb
, log
):
74 win
= TestPanel ( nb
, log
)
78 #----------------------------------------------------------------------
84 This demo shows how to encorporate Context Sensitive
85 help into your applicaiton using the wxSimpleHelpProvider class.
91 #----------------------------------------------------------------------