当前位置: 首页>>代码示例>>Python>>正文


Python ui.get_screen_size函数代码示例

本文整理汇总了Python中ui.get_screen_size函数的典型用法代码示例。如果您正苦于以下问题:Python get_screen_size函数的具体用法?Python get_screen_size怎么用?Python get_screen_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_screen_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

  def __init__(self, parent_vc=None):
    global logger
    
    super(SyncSelector, self).__init__(parent_vc)
    self.selected_index = None
    self.popup_vc = None
    self.load('sync_selector')
    self.tableview_sync_selector = self.find_subview_by_name('tableview_sync_selector')
    self.button_scan = self.find_subview_by_name('button_scan')
    self.button_sync = self.find_subview_by_name('button_sync')
    self.button_pyzipista = self.find_subview_by_name('button_pyzipista')
    self.button_working_copy = self.find_subview_by_name('button_working_copy')
    self.label_open_repository = self.find_subview_by_name('label_open_repository')
    self.label_pyzipista = self.find_subview_by_name('label_pyzipista')
    self.view_working_copy_icon = self.find_subview_by_name('imageview_icon_feature_1')
    self.view_pyzipista_icon = self.find_subview_by_name('imageview_icon_feature_2')
    
    self.view.width = min(ui.get_screen_size())
    self.view.height = min(ui.get_screen_size())

    image = ui.Image.named(IMAGE_URL_GITSYNCHISTA_ICON)
    self.find_subview_by_name('imageview_gitsynchista_icon').image = image
    
    if pyzipista_support.pyzipista_found():
      image = ui.Image.named(IMAGE_URL_PYZIPISTA_ICON).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
      self.view_pyzipista_icon.image = image
      self.button_pyzipista.image = image    
    
    image = ui.Image.named(IMAGE_URL_WORKING_COPY_ICON).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
    self.view_working_copy_icon.image = image
    self.button_working_copy.image = image    
    self.popup_vc = None
    self.pythonista_app_support = url_scheme_support.UrlSchemeSupport('pythonista')
开发者ID:MotherTeresaHS,项目名称:gitsynchista,代码行数:33,代码来源:sync_selector.py

示例2: __init__

 def __init__(self):
   super(PopupViewController, self).__init__(None)
   self.load('popup')
   self.info_text_view = self.find_subview_by_name('textview_info_text')
   self.button_view = self.find_subview_by_name('button_close')
   self.view.width = min(ui.get_screen_size())
   self.view.height = min(ui.get_screen_size())
开发者ID:MotherTeresaHS,项目名称:gitsynchista,代码行数:7,代码来源:popup.py

示例3: __init__

	def __init__ (self):
		global filename
		global textview
		filename = 'newfile.txt'
		
		self.background_color = ''
		#Textwell Button
		textwell_button = ui.ButtonItem()
		textwell_button.title = 'Textwell'
		textwell_button.action = self.export_textwell
		#Copy Button
		copy_button = ui.ButtonItem()
		copy_button.title = 'Copy'
		copy_button.action = self.export_clipboard
		#Action Button
		action_button = ui.ButtonItem()
		action_button.title = 'Action'
		action_button.tint_color = '#fd0000'
		action_button.action = self.action
		self.right_button_items = [copy_button,textwell_button]
		self.left_button_items = [action_button]
		
		textview = self.textview
		textview.background_color = '#EEE'
		textview.bordered = 0
		w,h = ui.get_screen_size()
		textview.width = w
		textview.height = h
		textview.flex = 'WH'
		textview.font = ('<system>',18)
		self.add_subview(textview)
开发者ID:PetitPocky,项目名称:TextEditor-for-Pythonista,代码行数:31,代码来源:TextEditor.py

示例4: tableview_cell_for_row

 def tableview_cell_for_row(self, tableview, section, row):
     self.width, height = ui.get_screen_size()
     cell = ui.TableViewCell()
     cell.bounds = (0, 0, self.width, self.row_height)
     for i in range(2):
         self.make_labels(cell, tableview.data_source.items[row][i], i)
     return cell
开发者ID:shanlihou,项目名称:pythonFunc,代码行数:7,代码来源:baidu.py

示例5: __init__

 def __init__(self, config):
     self.shape_type_def = {0: 'Null Shape',1: 'Point', 3: 'PolyLine', 5: 'Polygon', 8: 'MultiPoint', 11: 'PointZ', 13: 'PolyLineZ', 15: 'PolygonZ', 18: 'MultiPointZ', 21: 'PointM', 23: 'PolyLineM', 25: 'PolygonM', 28: 'MultiPointM', 31: 'MultiPatch'}
     
     #create an image depending on the screen size
     scr = ui.get_screen_size() * scene.get_screen_scale()
     self.scr_width = scr[0]
     self.scr_height = scr[1] - 64.0    #title bar = 64px
     
     if len(config) < 5:
         print 'Error: You need at least 5 parameter (xdelta, ydelta, background color, shape file, shape color)'
         sys.exit()
     
     self.xdelta = config[0]
     self.ydelta = config[1]
     self.bgcolor = config[2]
     self.pixel = 0
     self.imagebuffer = None
     self.drawbuffer = None
     self.linewidth = 1
     
     self.data = []
     
     for i in range(3, len(config), 2):
         self.read_file(config[i])
         self.color = config[i+1]
         self.convert_data(config[i])
     
     self.imagebuffer.show()
开发者ID:humberry,项目名称:ShapeFileRender,代码行数:28,代码来源:ShapeFileRender.py

示例6: __init__

	def __init__(self):
		screen_w, screen_h = ui.get_screen_size()
		ipad = min(screen_w, screen_h) >= 768
		diameter = floor(min(screen_w, screen_h) * 0.9)
		border = 20.0 if ipad else 12.0
		font_size = 70.0 if ipad else 32.0
		face_img = self.draw_face(diameter, border, font_size)		
		self.face_sprite = sk.SpriteNode(sk.Texture(face_img))
		self.face_sprite.position = self.size[0]/2, self.size[1]/2
		self.add_child(self.face_sprite)
		hand_length = diameter/2 - font_size
		hand_width = 15 if ipad else 12
		second_hand_img = self.draw_hand(hand_width/1.5, hand_length, 'red')
		minute_hand_img = self.draw_hand(hand_width, hand_length, 'black')
		hour_hand_img = self.draw_hand(hand_width, hand_length*0.7, 'black')
		self.second_hand_sprite = sk.SpriteNode(sk.Texture(second_hand_img))
		self.second_hand_sprite.anchor_point = (0.5, 0.0)
		self.minute_hand_sprite = sk.SpriteNode(sk.Texture(minute_hand_img))
		self.minute_hand_sprite.anchor_point = (0.5, 0.0)
		self.hour_hand_sprite = sk.SpriteNode(sk.Texture(hour_hand_img))
		self.hour_hand_sprite.anchor_point = (0.5, 0.0)
		self.face_sprite.add_child(self.hour_hand_sprite)
		self.face_sprite.add_child(self.minute_hand_sprite)
		self.face_sprite.add_child(self.second_hand_sprite)
		self.center_sprite = sk.SpriteNode(sk.Texture(self.draw_center(hand_width*1.5, 'black')))
		self.face_sprite.add_child(self.center_sprite)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:26,代码来源:Analog+Clock.py

示例7: __init__

	def __init__(self,fldname,dateval,action=None):
		self.days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
		self.width,self.height = ui.get_screen_size()
		cv = ui.View(name=fldname)
		cv.frame = (0,95,self.width,255)
		cv.background_color = 'yellow'
		cv.border_color = 'yellow'
		cv.border_width = 2
		self.view = cv
		self.action = action 
		prv_mth = ui.Button(title='<')
		prv_mth.frame = (5,5,50,25)
		prv_mth.action = self.prev_pressed
		self.day_color = prv_mth.tint_color 
		self.view.add_subview(prv_mth)
		nxt_mth = ui.Button(title='>')
		nxt_mth.frame = (56,5,50,25)
		nxt_mth.action = self.next_pressed
		self.view.add_subview(nxt_mth)
		label = ui.Label(name='caltitle')
		self.caldate = dateval #dt.datetime.strptime(dateval,'%d/%m/%Y')
		self.curdate = curdate = dt.datetime.today()
		label.text = str(self.caldate.strftime('%B  %Y'))
		label.frame = (107,5,200,25)
		label.alignment = ui.ALIGN_CENTER
		self.view.add_subview(label)
		today_btn = ui.Button(title='Today')
		today_btn.frame = (self.width-60,5,50,25)
		today_btn.action = self.today_pressed
		self.view.add_subview(today_btn)
		self.firstdate = dt.date(self.caldate.year,self.caldate.month,1)
		self.create_buttons()
		self.draw_calendar()
开发者ID:cclauss,项目名称:pythonista-1,代码行数:33,代码来源:calview.py

示例8: get_keyboard_frame

    def get_keyboard_frame(self,frame=None):
        '''get corrected keyboard frame, in the screen coordinates.
        built in function breaks when in fullscreen, as it reports kbframe relative to a landscape screen'''
        #TODO:  remove dependence on webview, use xaxis/yaxis to determine rotation instead

        if frame is None:
            frame=ui.get_keyboard_frame()
        origin=ui.convert_point((0,0),None,self )
        xaxis=ui.convert_point((1,0),None,self )
        xaxis=[xaxis[j]-origin[j] for j in (0,1)]
        yaxis=ui.convert_point((0,1),None,self )
        yaxis=[yaxis[j]-origin[j] for j in (0,1)]

        o=self.__w.eval_js('window.orientation')

        (w,h)=ui.get_screen_size()

        if xaxis[0]==1 and yaxis[1]==1 and frame[0]==0:
            #we are not in fullscreen, just return kbframe
            fixedframe=frame
        elif o=='0':
            fixedframe= frame            #ok
        elif o=='-90':

            fixedframe= [frame[1], frame[0], h,frame[2]]
        elif o=='180':
            fixedframe= [frame[0], h-frame[1]-frame[3], frame[2],frame[3]]        #okrqq
        elif o=='90':
            fixedframe= [frame[1], w-frame[0]-frame[2],h,frame[2]]
        else:
            raise Error('UnexpectedOrientation')
        return fixedframe
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:32,代码来源:RootView.py

示例9: _iphone_interface_layout

  def _iphone_interface_layout(self):
    """ 
	    	Alters the layout to suit an iPhone. 
	    	Arguments: 
	  	Specifics:
	  """ 
	  
    try:
      # first cal calculate proportions based on the golden ratio
      Proportion = 5
      BufferBetweenCampaignListAndContent = 30
      
      Width = ui.get_screen_size()[1]
      print(Width)
      ContentWidth = (Width / Proportion) * 4
      print(ContentWidth)
      CampaignListWidth = Width - ContentWidth
      print(CampaignListWidth)
      print(Width, ContentWidth, CampaignListWidth)
      ContentLeft = CampaignListWidth + BufferBetweenCampaignListAndContent
      
      self.vwInterface['tblCampaigns'].x = 0
      self.vwInterface['tblCampaigns'].width = CampaignListWidth
      self.vwInterface['segCampaign'].x = ContentLeft
      self.vwInterface['lblDescription'].x = ContentLeft

    except:
      pass
开发者ID:ssnowden,项目名称:TravellerAidApp,代码行数:28,代码来源:Campaign+Management.py

示例10: main

def main(args):
    if ui.get_screen_size()[0] >= 768:
        from filenav import full
        full.main(args)
    else:
        from filenav import slim
        slim.main(args)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:7,代码来源:__main__.py

示例11: convert_point

    def convert_point(point=(0,0),from_view=None,to_view=None):
        '''fixed convert point for fullscreen application.
        works for any present type
        existing function in fullscreen reports relative to portrait
        TODO: does not work if from_view or to_view has been Transformed'''

        (w,h)=ui.get_screen_size()

        #detect what convert_point things rotation is.
        origin=ui.convert_point((0,0),from_view,to_view )
        xaxis=ui.convert_point((1,0),from_view,to_view )
        xaxis=[xaxis[j]-origin[j] for j in (0,1)]
        yaxis=ui.convert_point((0,1),from_view,to_view )
        yaxis=[yaxis[j]-origin[j] for j in (0,1)]
        pt_c=ui.convert_point(tuple(point),from_view,to_view)
        pt=[0,0]

        if from_view is not None:
            pt[0]=( (xaxis[0]==-1)*h
                  + xaxis[0]*pt_c[0]
                  + (yaxis[0]==1)*w
                  - yaxis[0]*pt_c[1])

            pt[1] = ( (xaxis[1]==1)*h
                    - xaxis[1]*pt_c[0]
                    + (yaxis[1]==-1)*w
                    + yaxis[1]*pt_c[1])
        else:  #just get corrected origin, and subtract out
            origin_offset=RootView.convert_point((0,0),to_view,from_view)
            pt[0]=  point[0]  - origin_offset[0]
            pt[1]=  point[1]  - origin_offset[1]
        return tuple(pt)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:32,代码来源:RootView.py

示例12: display_toast

def display_toast(view, help_text, width = 220, height = 110, show_duration=2, fade_duration=0.5, background_colour=(.42, .42, .42), text_colour= (.96, .96, .96), corner_radius=10):

	w, h = ui.get_screen_size()

	help_view = ui.View(frame=((w/2)-(width/2),(h/2)-height, width, height))
	help_view.background_color = background_colour
	help_view.corner_radius = corner_radius

	label = ui.Label()
	label.text = help_text
	label.flex = 'H'
	label.width = help_view.width * 0.9
	label.alignment = ui.ALIGN_CENTER
	label.x = (help_view.width / 2) - (label.width / 2)
	label.y = (help_view.height / 2) - (label.height / 2)
	label.number_of_lines = 3

	label.text_color = text_colour

	help_view.add_subview(label)

	def animation_fade_in():
		help_view.alpha = 1.0
	def animation_fade_out():
		help_view.alpha = 0.0

	help_view.alpha = 0.0
	view.add_subview(help_view)
	ui.animate(animation_fade_in, duration=fade_duration)
	time.sleep(show_duration+fade_duration)
	ui.animate(animation_fade_out, duration=fade_duration)
	time.sleep(fade_duration)
	view.remove_subview(help_view)
开发者ID:shaun-h,项目名称:istaflow,代码行数:33,代码来源:ToastView.py

示例13: __init__

	def __init__(self, pad, *args, **kwargs):
		#super().__init__(self, *args, **kwargs)	
		self.width = ui.get_screen_size()[0]			# width of keyboard = screen
		self.background_color = 'lightgray'#(0,1,0,0.2)
		self.h_button = 32	
		self.pad = pad

		#================================================ for the fun begin		
		# cable for road
		self.road = ui.Label()
		self.road.frame = (0,40,self.width,1)
		self.road.border_width = 1
		self.road.border_color = 'green'
		self.road.flex = 'W'
		self.add_subview(self.road)
		
		# cable for tramway
		self.line = ui.Label()
		self.line.frame = (0,12,self.width,1)
		self.line.border_width = 1
		self.line.border_color = 'gray'
		self.line.flex = 'W'
		self.line.hidden = True
		self.add_subview(self.line)
		
		# moving emoji behind buttons
		self.moving = ui.Button()
		self.moving.font = ('<system>',self.h_button-4)
		self.moving.frame = (0,10,self.h_button,self.h_button)
		self.moving.icons = ['emj:Delivery_Truck', 'emj:Car_1','emj:Car_2', 'emj:Bus', 'emj:Police_Car', 'emj:Railway_Car','emj:Speedboat']
		self.moving.action = self.fun
		self.moving.index = 0
		self.add_subview(self.moving)
		self.update_interval = 0.06
		#================================================ for the fun end
		
		# build buttons
    		for pad_elem in self.pad:
			if pad_elem['key'] in ('nul', 'new row'):		#  free space or new row
				continue
			button = ui.Button()									# Button for user functionnality
			button.name = pad_elem['key']
			button.background_color = 'white'			# or any other color
			button.tint_color = 'black'
			button.corner_radius = 5		
			button.font = ('<system>',self.h_button - 8)
			button.title = ''
			if 'title' in pad_elem:
				button.title = pad_elem['title']
			elif 'icon' in pad_elem:
				button.image = ui.Image.named(pad_elem['icon']).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
			else:
				button.title = pad_elem['key']

			button.action = key_pressed
			retain_global(button) # see https://forum.omz-software.com/topic/4653/button-action-not-called-when-view-is-added-to-native-view
			self.add_subview(button)	
		self.layout()		
开发者ID:cvpe,项目名称:Pythonista-scripts,代码行数:58,代码来源:AddButtonsToPythonistaKeyboard.py

示例14: load

def load(self):
    # We use a quadratic canvas, so that the same image
    # can be used in portrait and landscape orientation.
    w, h = ui.get_screen_size()
    canvas_size = max(w, h)

    sv = SketchView(canvas_size, canvas_size)
    sv.name = 'Sketch Pad'
    sv.present('fullscreen')
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:9,代码来源:sketch_app.py

示例15: switch_back

	def switch_back(self):
		global button
		button = ui.Button(image = ui.Image.named('ionicons-ios7-contact-outline-256'))
		button.tint_color = 'white'
		button.flex = 'TR'
		button.width = button.height = 120
		button.y = (ui.get_screen_size()[1]) - (120)
		button.action = change_character
		root_view.add_subview(button)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:9,代码来源:ck.py


注:本文中的ui.get_screen_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。