• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ui.get_screen_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetTextFieldPad

def SetTextFieldPad(tf):
	
	tfo = ObjCInstance(tf).textField() # UITextField is subview of ui.TextField
	
	# design your keyboard

	v = MyView(tf)
	w,h = ui.get_screen_size()
	if w < h:
		mode = 'portrait'
	else:
		mode = 'landscape'
	r = w/12

	for i in range(1,7):
		b = ui.Button()
		b.name = str(i)
		b.background_color = (1,0,0,0.5)
		b.tint_color = (1,1,1,0.8)
		b.font = ('Academy Engraved LET',r*1.2)
		b.corner_radius = r
		b.title = b.name
		x,y = v.settings[mode][b.name]
		b.frame = (x,y,r*2,r*2)
		b.TextField = tf # store tf as key attribute  needed when pressed
		b.touch_enabled = False
		v.add_subview(b)

	v.width  = w
	v.height = h

	# view of keyboard
	retain_global(v) # see https://forum.omz-software.com/topic/4653/button-action-not-called-when-view-is-added-to-native-view
	tfo.setInputAccessoryView_(ObjCInstance(v))	# attach accessory to textview
	#print(dir(tfo))
	
	# remove standard keyboard
	v.height = ui.get_screen_size()[1]
	vk = ui.View()
	vk.frame = (0,0,w,0)
	tfo.setInputView_(ObjCInstance(vk))
	#  remove undo/redo/paste BarButtons above standard keyboard
	tfo.inputAssistantItem().setLeadingBarButtonGroups(None)
	tfo.inputAssistantItem().setTrailingBarButtonGroups(None)
开发者ID:cvpe,项目名称:Pythonista-scripts,代码行数:44,代码来源:BrailleInput2.py


示例17: screen_frames

def screen_frames(status_height=24):
    w, h = ui.get_screen_size()  # (1024, 768) on iPad in landscape mode
    assert w > h, 'This app only works in landscape mode!!'
    square_side = min(w, h) - status_height  # make room for a few lines of status text
    panel_width = (w - square_side) / 2
    center_frame = sk.Rect(panel_width, 0, square_side, square_side)
    left_frame   = sk.Rect(0, 0, panel_width, square_side)
    right_frame  = sk.Rect(panel_width + square_side, 0, panel_width, square_side)
    status_frame = sk.Rect(0, square_side, w, status_height)
    return center_frame, left_frame, right_frame, status_frame
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:10,代码来源:SkChessView.py


示例18: main

def main():
	console.clear()
	
	# Hide script
	w, h = ui.get_screen_size()
	disp = 'full_screen'
	back = MyView(w, h)
	back.background_color='white'
	back.present(disp, hide_title_bar=False)
	back.process()
开发者ID:cvpe,项目名称:Pythonista-scripts,代码行数:10,代码来源:Add+home+screen+shortcut.py


示例19: 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, name in enumerate(self.nameList):
            item = tableview.data_source.items[row]
            text = getattr(item, name)
            self.make_labels(cell, text, i)

        return cell
开发者ID:shanlihou,项目名称:pythonFunc,代码行数:10,代码来源:MyPwd.py


示例20: main

def main():
	checkKey()
	view = ui.load_view('Working_Copy_Sync')
	width, height = ui.get_screen_size()
	try:
		if width >= 768:
			view.present('sheet', hide_title_bar=True)
		else:
			view.present(hide_title_bar=True)
	except KeyboardInterrupt:
		pass
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:11,代码来源:Working_Copy_Sync.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui.label函数代码示例发布时间:2022-05-27
下一篇:
Python ui.error函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap