def textwidth(self, txt, width=None):
        '''

        :return: the width of a string of text according to the current
        font settings.
        '''
        w = width
        return self.textmetrics(txt, width=w)[0]
def textwidth ( self , txt , width = None ) : w = width return self . textmetrics ( txt , width = w ) [ 0 ]
:return: the width of a string of text according to the current
        font settings.