(self, slack_ratio)
return int(canvas[0] * border_ratio), int(canvas[1] * border_ratio)
Determine the optimal size for a non-natively scaled window.
Determine the optimal size for a non-natively scaled window.
Determine the optimal size for a non - natively scaled window .
def _find_nonnative_window_size(self, slack_ratio):
        """Determine the optimal size for a non-natively scaled window."""
        # border is given as a percentage of canvas size
        border_ratio = 1. + self._border_pct / 100.
        # shrink the window in the most constraining dimension
        mcd = _most_constraining(self._screen_size, self._aspect)
        lcd = 1 - mcd
        # scale MCD to fit screen height, leaving slack
        canvas = [0, 0]
        canvas[mcd] = slack_ratio * self._screen_size[mcd] / border_ratio
        # scale LCD to match aspect ratio
        canvas[lcd] = (canvas[mcd] * self._aspect[lcd]) / float(self._aspect[mcd])
        # add back border and ensure pixel sizes are integers
        return int(canvas[0] * border_ratio), int(canvas[1] * border_ratio)
def _find_nonnative_window_size ( self , slack_ratio ) : # border is given as a percentage of canvas size border_ratio = 1. + self . _border_pct / 100. # shrink the window in the most constraining dimension mcd = _most_constraining ( self . _screen_size , self . _aspect ) lcd = 1 - mcd # scale MCD to fit screen height, leaving slack canvas = [ 0 , 0 ] canvas [ mcd ] = slack_ratio * self . _screen_size [ mcd ] / border_ratio # scale LCD to match aspect ratio canvas [ lcd ] = ( canvas [ mcd ] * self . _aspect [ lcd ] ) / float ( self . _aspect [ mcd ] ) # add back border and ensure pixel sizes are integers return int ( canvas [ 0 ] * border_ratio ) , int ( canvas [ 1 ] * border_ratio )