== Introduction == This section contains usefull controls for providing help to the user, these can include context-sensitive help, help menus, tooltips etc. == Recipies == === Help Button Using wxTransientPopup === This widget is a help button that uses wxPop''''''Up''''''Transient''''''Window to create a button, which when clicked upon will open a flyout window containing the help contents. (note: thanks to the writer of the wx''''''Transient''''''Window example included with the wxPy demo, I stole some of your code ^_^) ==== Code ==== Add the following to your GUI, make sure to define an ID for your button: {{{ #!python NameTextCtrlBtn = wxButton(self, ID_HELPBTN, "?", size = wxSize(20,20)) EVT_BUTTON(self, ID_HELPBTN, self.OnHelpBtn) }}} This code snippit is tied to the buttonpress and creates the transient window (Taken from wxPy demo): {{{ #!python def OnHelpBtn(self, event): win = HelpTransientPopup(self) # Show the popup right below or above the button # depending on available screen space... btn = event.GetEventObject() pos = btn.ClientToScreen( (0,0) ) sz = btn.GetSize() win.Position(pos, (0, sz.height)) win.Popup() }}} And finally, this code snippit represents the transient window: {{{ #!python class HelpTransientPopup(wxPopupTransientWindow): def __init__(self, parent): wxPopupTransientWindow.__init__(self, parent, wxSIMPLE_BORDER) panel = wxPanel(self, -1) panel.SetBackgroundColour("WHITE") st = wxStaticText(panel, -1, "Name Formatting Help:\n" "Input any text you wish, special tags\n" "listed below will be replaced with\n" "the corresponding info extracted from\n" "the MP3 file. The tags are: \n" ", , <genre>, <track#>,\n" "<album>, <year>" , pos=(10,10)) sz = st.GetBestSize() panel.SetSize( (sz.width+20, sz.height+20) ) self.SetSize(panel.GetSize()) }}} ==== Comments ==== 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 (sanguinus@earthlink.net)