Gnumed.wxpython.gmShadow API documentation
Description: GNUmed widget shadowing …

# Module `Gnumed.wxpython.gmShadow`

GNUmed widget shadowing.

A module to add shadowing to an arbitrary widget.

## Classes

`class Shadow (parent, id)`
  Expand source code

      class Shadow (wx.Panel):
              def __init__(self, parent, id):
                      """Create a new shadow.
                      """
                      wx.Panel.__init__ (self, parent, id)
                      self.sh_width = 100
                      wx.EVT_SIZE (self, self.OnSize)
                      wx.EVT_PAINT (self, self.OnPaint)
              #-----------------------------------------------------
              def SetContents (self, widget):
                      """Marry a widget and a shadow.

                      Widget MUST have parent=Shadow widget, and pos=(0,0)
                      """
                      self.contents = widget
              #-----------------------------------------------------
              def OnSize (self, event):
                      w, h = self.GetClientSize ()
                      self.contents.SetClientSizeWH (w-self.sh_width, h-self.sh_width)
              #-----------------------------------------------------
              def OnPaint (self, event):
                      dc = wx.PaintDC (self)
                      w, h = self.GetClientSize ()
                      dc.SetPen (wx.TRANSPARENT_PEN)
                      #dc.SetBrush (wxWHITE_BRUSH)
                      dc.SetBrush (wx.Brush (wx.Colour (240, 240, 240), wx.SOLID))
                      # draw white bars
                      dc.DrawRectangle (0, h-self.sh_width, w, self.sh_width)
                      dc.DrawRectangle (w-self.sh_width, 0, self.sh_width, h)
                      r, g, b = (1, 2, 3)
                      dc.SetBrush (wx.Brush (wx.Colour (r, g, b), wx.SOLID))
                      # draw grey bars half as thick
                      dc.DrawRectangle (
                              self.sh_width/2,
                              h-self.sh_width,
                              w-self.sh_width,
                              self.sh_width/2
                      )
                      dc.DrawRectangle (
                              w-self.sh_width,
                              self.sh_width/2,
                              self.sh_width/2,
                              h-self.sh_width-self.sh_width/2
                      )

  Panel() Panel(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TAB_TRAVERSAL, name=PanelNameStr)

  A panel is a window on which controls are placed.

  Create a new shadow.

  ### Ancestors

  - wx._core.Panel
  - wx._core.Window
  - wx._core.WindowBase
  - wx._core.EvtHandler
  - wx._core.Object
  - wx._core.Trackable
  - sip.wrapper
  - sip.simplewrapper

  ### Methods

  `def OnPaint(self, event)`
    Expand source code

        def OnPaint (self, event):
                dc = wx.PaintDC (self)
                w, h = self.GetClientSize ()
                dc.SetPen (wx.TRANSPARENT_PEN)
                #dc.SetBrush (wxWHITE_BRUSH)
                dc.SetBrush (wx.Brush (wx.Colour (240, 240, 240), wx.SOLID))
                # draw white bars
                dc.DrawRectangle (0, h-self.sh_width, w, self.sh_width)
                dc.DrawRectangle (w-self.sh_width, 0, self.sh_width, h)
                r, g, b = (1, 2, 3)
                dc.SetBrush (wx.Brush (wx.Colour (r, g, b), wx.SOLID))
                # draw grey bars half as thick
                dc.DrawRectangle (
                        self.sh_width/2,
                        h-self.sh_width,
                        w-self.sh_width,
                        self.sh_width/2
                )
                dc.DrawRectangle (
                        w-self.sh_width,
                        self.sh_width/2,
                        self.sh_width/2,
                        h-self.sh_width-self.sh_width/2
                )

  `def OnSize(self, event)`
    Expand source code

        def OnSize (self, event):
                w, h = self.GetClientSize ()
                self.contents.SetClientSizeWH (w-self.sh_width, h-self.sh_width)

  `def SetContents(self, widget)`
    Expand source code

        def SetContents (self, widget):
                """Marry a widget and a shadow.

                Widget MUST have parent=Shadow widget, and pos=(0,0)
                """
                self.contents = widget

    Marry a widget and a shadow.

    Widget MUST have parent=Shadow widget, and pos=(0,0)