[ANN] jmMsgBox and jmScrolledMsgBox

jmf jfauth at bluewin.ch
Thu Jul 13 12:13:48 PDT 2006


* jmMsgBox and jmScrolledMsgBox are fancy message boxes allowing messages
   to be displayed in various flavours: fonts (including fixed pitched fonts),
   text foreground/background colours, icons, borders, text alignment and so on.
* The jmMsgBox behaves like the standard wx.MessageDialog or wx.MessageBox, and
   it even works better with long messages (at least on win platforms). It
   uses its own text wrapping mechanism.
* An interesting feature is the ability to save the message in the clipboard
   just by pressing F12.

The two classes:

# A message box
#
# The message is splitted in several lines according to the underlaying static
# text font. A too long message will not be completely displayed.
# Separate options instead of a combined flag.
# F12 saves the message in the clipboard.
#
# Arguments
# parent, id : usual "wx stuff"
# title      : message box title, string
# msg        : message, string
# button     : OK, YesNo, YesNoDefaultYes, YesNODefaultNo with YesNo defaults
#              to YesNoDefaultYes, string
# icon       : information, question, error, warning, tip, no, string
# align      : left, center, right, string
# border     : no, sunken, raised, simple, string
# forecolour : text foreground colour, wxColour
# backcolour : text background colour, wx.Colour
# font       : text font, a valid wx.Font or None for "system font"
#
# Returned value
# A wx standard value, wx.ID_OK, wx.ID_YES, wx.ID_NO or wx.ID_CANCEL.

class jmMsgBox(wx.Dialog):

     def __init__(self, parent, id, title='Message', msg='', button='OK', 
icon='information', \
                 align='left', border='no', forecolour='', backcolour='', 
font=None):
         wx.Dialog.__init__(self, parent, id, title)

----------

# A scrolled message box
# The message is displayed in a multiline text control.
# Separate options instead of a combined flag.
# F12 saves the message in the clipboard.
#
# Arguments
# parent, id : usual "wx stuff"
# title      : message box title, string
# size       : size of the dialog window, tuple/wxSize
# msg        : message, string
# button     : OK, YesNo, YesNoDefaultYes, YesNODefaultNo, string
# icon       : information, question, error, warning, tip, no, string
# align      : left, center, right, string
# border     : no, sunken, raised, simple
# forecolour : text foreground colour, wxColour
# backcolour : text background colour, wx.Colour
# font       : text font, a valid wx.Font or None for "system font"

# Returned value
# A wx standard value, wx.ID_OK, wx.ID_YES, wx.ID_NO or wx.ID_CANCEL.


class jmScrolledMsgBox(wx.Dialog):

     def __init__(self, parent, id, title='Message', size=(400, 300), msg='', 
button='OK', \
                 icon='', align='left', border='no', forecolour='', 
backcolour='', font=None):
         wx.Dialog.__init__(self, parent, id, title, wx.DefaultPosition, size)

----------

See http://www.chez.com/spinecho/ for screenshots, Python scripts, etc.

As usual, feedback (improvements, bugs) is welcome. Have fun.

Jean-Michel Fauth, Switzerland.




More information about the wxpython-users mailing list