This section contains usefull controls for providing help to the user, these can include context-sensitive help, help menus, tooltips etc.
Help Button Using wxTransientPopup
This widget is a help button that uses wxPopUpTransientWindow to create a button, which when clicked upon will open a flyout window containing the help contents. (note: thanks to the writer of the wxTransientWindow example included with the wxPy demo, I stole some of your code _)
Add the following to your GUI, make sure to define an ID for your button:
This code snippit is tied to the buttonpress and creates the transient window (Taken from wxPy demo):
And finally, this code snippit represents the transient window:
1 class HelpTransientPopup(wxPopupTransientWindow): 2 def __init__(self, parent): 3 wxPopupTransientWindow.__init__(self, parent, wxSIMPLE_BORDER) 4 panel = wxPanel(self, -1) 5 panel.SetBackgroundColour("WHITE") 6 st = wxStaticText(panel, -1, 7 "Name Formatting Help:\n" 8 "Input any text you wish, special tags\n" 9 "listed below will be replaced with\n" 10 "the corresponding info extracted from\n" 11 "the MP3 file. The tags are: \n" 12 "<artist>, <title>, <genre>, <track#>,\n" 13 "<album>, <year>" 14 , 15 pos=(10,10)) 16 sz = st.GetBestSize() 17 panel.SetSize( (sz.width+20, sz.height+20) ) 18 self.SetSize(panel.GetSize())
This could definately be expanded upon by passing in another variable on init containing the string to be displayed in the transientwindow, or alternatively you could tie a key to the button and pass that key which would reference the help string from a dictionary.
Hope someone finds a use for this, Jeff Peck (firstname.lastname@example.org)