#NEWLINE# @ staticmethod #NEWLINE# def DrawString( dc , text , bounds , align = wx . ALIGN_LEFT , valign = wx . ALIGN_TOP , allowClipping = False ) : #NEWLINE# #INDENT# '\n        Draw the given text word-wrapped within the given bounds.\n\n        bounds must be a wx.Rect or a 4-element collection: (left, top, width, height).\n\n        If allowClipping is True, this method changes the clipping region so that no\n        text is drawn outside of the given bounds.\n        ' #NEWLINE# if ( not text ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( align == wx . ALIGN_CENTER ) : #NEWLINE# #INDENT# align = wx . ALIGN_CENTER_HORIZONTAL #NEWLINE# #UNINDENT# if ( bounds == wx . ALIGN_CENTER ) : #NEWLINE# #INDENT# valign = wx . ALIGN_CENTER_VERTICAL #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# bounds = wx . Rect ( * bounds ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if allowClipping : #NEWLINE# #INDENT# clipper = wx . DCClipper ( dc , bounds ) #NEWLINE# #UNINDENT# text = text . rstrip ( ' ' ) #NEWLINE# lines = wordwrap ( text , bounds [ 2 ] , dc , True ) #NEWLINE# dc . DrawLabel ( lines , bounds , ( align | valign ) )