def update(self, *args): width = self.fontMetrics().width(str(self.highest_line)) + 25 if self.width() != width: self.setFixedWidth(width) QWidget.update(self, *args)
def update(self, *args): ''' Updates the number bar to display the current set of numbers. Also, adjusts the width of the number bar if necessary. ''' # The + 4 is used to compensate for the current line being bold. width = self.fontMetrics().width(self.highest_line) + 4 if self.width() != width: self.setFixedWidth(width) QWidget.update(self, *args)