Attachment 'AddLinearSpacer.PY'

Download


""" Simple, foolproof function to properly insert a
one-dimensional spacer along its major axis 
regardless of the sizer's orientation.

This is a safer alternative to the .AddSpacer( n ) 
method which produces a square shaped spacer which can
unintentionally interfere with adjacent controls and 
control blocks stacked along the minor axis by an 
outer sizer. 

Ray Pasco
2010-09-25-Sat__PM-03-14-19__September
"""

import wx

def AddLinearSpacer( boxsizer, pixelSpacing ) :
    """ A one-dimensional spacer for use with any BoxSizer """

    orientation = boxsizer.GetOrientation()
    if   (orientation == wx.HORIZONTAL) :
        boxsizer.Add( (pixelSpacing, 0) )

    elif (orientation == wx.VERTICAL) :
        boxsizer.Add( (0, pixelSpacing) )
    #end if

#end def

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-10-03 00:02:35, 0.8 KB) [[attachment:AddLinearSpacer.PY]]
  • [get | view] (2010-09-27 21:22:43, 0.6 KB) [[attachment:AddLinearSpacer.py]]
  • [get | view] (2010-10-03 00:07:55, 15.1 KB) [[attachment:DUAL_CONTROL_CLASS_1.PNG]]
  • [get | view] (2010-10-03 16:43:05, 2.9 KB) [[attachment:DUAL_CONTROL_CLASS_1.PY]]
  • [get | view] (2010-10-03 00:08:04, 17.3 KB) [[attachment:DUAL_CONTROL_CLASS_2.PNG]]
  • [get | view] (2010-10-03 16:42:58, 4.3 KB) [[attachment:DUAL_CONTROL_CLASS_2.PY]]
  • [get | view] (2010-10-03 00:08:11, 18.1 KB) [[attachment:DUAL_CONTROL_CLASS_3.PNG]]
  • [get | view] (2010-10-03 16:43:16, 4.4 KB) [[attachment:DUAL_CONTROL_CLASS_3.PY]]
  • [get | view] (2010-10-03 16:13:27, 21.6 KB) [[attachment:DUAL_CONTROL_CLASS_4.PNG]]
  • [get | view] (2010-10-03 16:44:24, 5.3 KB) [[attachment:DUAL_CONTROL_CLASS_4.PY]]
  • [get | view] (2010-09-30 16:11:37, 42.7 KB) [[attachment:DUAL_SIZER_SKETCH.PNG]]
  • [get | view] (2010-09-30 17:37:50, 6.5 KB) [[attachment:DUAL_SIZER_SKETCH_ANNO.PNG]]
  • [get | view] (2010-09-30 17:46:56, 13.6 KB) [[attachment:DUAL_SIZER_SKETCH_EXPLODED.PNG]]
  • [get | view] (2010-09-28 18:55:07, 4.2 KB) [[attachment:LIGHTBULB.64x64.PNG]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.