示例#1
0
 def get_mm(self):
     return dpi2px(1, 'mm')
示例#2
0
 def get_pt(self):
     return dpi2px(1, 'pt')
示例#3
0
 def get_cm(self):
     return dpi2px(1, 'cm')
示例#4
0
 def get_dp(self):
     return dpi2px(1, 'dp')
示例#5
0
 def get_sp(self):
     return dpi2px(1, 'sp')
示例#6
0
def sp(value) -> float:
    '''Convert from scale-independent pixels to pixels
    '''
    return dpi2px(value, 'sp')
示例#7
0
 def get_in(self):
     # we bind to all dpi, density, fontscale, even though not all may be
     # used for a specific suffix, because we don't want to rely on the
     # internal details of dpi2px. But it will be one of the three. But it's
     # an issue, since it won't trigger the prop if the value doesn't change
     return dpi2px(1, 'in')
示例#8
0
def dp(value) -> float:
    '''Convert from density-independent pixels to pixels
    '''
    return dpi2px(value, 'dp')
示例#9
0
def mm(value) -> float:
    '''Convert from millimeters to pixels
    '''
    return dpi2px(value, 'mm')
示例#10
0
def cm(value) -> float:
    '''Convert from centimeters to pixels
    '''
    return dpi2px(value, 'cm')
示例#11
0
def inch(value) -> float:
    '''Convert from inches to pixels
    '''
    return dpi2px(value, 'in')
示例#12
0
def pt(value) -> float:
    '''Convert from points to pixels
    '''
    return dpi2px(value, 'pt')