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


Python Pixbuf.new_from_file_at_scale方法代码示例

本文整理汇总了Python中gi.repository.GdkPixbuf.Pixbuf.new_from_file_at_scale方法的典型用法代码示例。如果您正苦于以下问题:Python Pixbuf.new_from_file_at_scale方法的具体用法?Python Pixbuf.new_from_file_at_scale怎么用?Python Pixbuf.new_from_file_at_scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.GdkPixbuf.Pixbuf的用法示例。


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

示例1: popular_controles

# 需要导入模块: from gi.repository.GdkPixbuf import Pixbuf [as 别名]
# 或者: from gi.repository.GdkPixbuf.Pixbuf import new_from_file_at_scale [as 别名]
	def popular_controles(self):
		pb = Pixbuf.new_from_file_at_scale("imagem_dia.jpg", width=50, height=50,preserve_aspect_ratio=False)
		self.imagem.set_from_pixbuf(pb)

		self.cidade.set_text(self.conteudo['cidade'])
		self.descricao.set_text(self.conteudo['agora']['descricao'])
		self.temperatura.set_text('Temperatura: ' + self.conteudo['agora']['temperatura'] + ' graus')
		self.umidade.set_text('Umidade: ' + self.conteudo['agora']['umidade'])


		for num, value in enumerate(self.conteudo['previsoes']):
			if num == 1:
				self.previsao_dia1.set_text(value['data'])
				self.descricao_dia1.set_text(value['descricao'])
				img_url = value['imagem']
				response = urllib.request.urlopen(img_url)
				with open("imagem_dia1.jpg", 'wb') as f:
					f.write(response.read())
				pb = Pixbuf.new_from_file_at_scale("imagem_dia1.jpg", width=50, height=50,preserve_aspect_ratio=False)
				self.imagem_dia1.set_from_pixbuf(pb)
				self.max_min_dia1.set_text("Max: " + value['temperatura_max'] + " Min: " + value['temperatura_min'])
			elif num == 2:
				self.previsao_dia2.set_text(value['data'])
				self.descricao_dia2.set_text(value['descricao'])
				img_url = value['imagem']
				response = urllib.request.urlopen(img_url)
				with open("imagem_dia2.jpg", 'wb') as f:
					f.write(response.read())
				pb = Pixbuf.new_from_file_at_scale("imagem_dia2.jpg", width=50, height=50,preserve_aspect_ratio=False)
				self.imagem_dia2.set_from_pixbuf(pb)
				self.max_min_dia2.set_text("Max: " + value['temperatura_max'] + " Min: " + value['temperatura_min'])
			elif num == 3:
				self.previsao_dia3.set_text(value['data'])
				self.descricao_dia3.set_text(value['descricao'])
				img_url = value['imagem']
				response = urllib.request.urlopen(img_url)
				with open("imagem_dia3.jpg", 'wb') as f:
					f.write(response.read())
				pb = Pixbuf.new_from_file_at_scale("imagem_dia3.jpg", width=50, height=50,preserve_aspect_ratio=False)
				self.imagem_dia3.set_from_pixbuf(pb)
				self.max_min_dia3.set_text("Max: " + value['temperatura_max'] + " Min: " + value['temperatura_min'])
			elif num == 4:
				self.previsao_dia4.set_text(value['data'])
				self.descricao_dia4.set_text(value['descricao'])
				img_url = value['imagem']
				response = urllib.request.urlopen(img_url)
				with open("imagem_dia4.jpg", 'wb') as f:
					f.write(response.read())
				pb = Pixbuf.new_from_file_at_scale("imagem_dia4.jpg", width=50, height=50,preserve_aspect_ratio=False)
				self.imagem_dia4.set_from_pixbuf(pb)
				self.max_min_dia4.set_text("Max: " + value['temperatura_max'] + " Min: " + value['temperatura_min'])
开发者ID:n0tch,项目名称:tempo,代码行数:53,代码来源:main.py

示例2: setImage

# 需要导入模块: from gi.repository.GdkPixbuf import Pixbuf [as 别名]
# 或者: from gi.repository.GdkPixbuf.Pixbuf import new_from_file_at_scale [as 别名]
 def setImage(self, fileName):
     if not self.settingsManager.resizeImage:
         mpixbuf = Pixbuf.new_from_file(fileName)
     else:
         mpixbuf = Pixbuf.new_from_file_at_scale(fileName, self.iCurWidth, self.iCurHeight, True)
     self.currentFile = fileName
     Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.GtkSetImage, mpixbuf)
开发者ID:swag4swag,项目名称:pybooru,代码行数:9,代码来源:main.py

示例3: resizeImage

# 需要导入模块: from gi.repository.GdkPixbuf import Pixbuf [as 别名]
# 或者: from gi.repository.GdkPixbuf.Pixbuf import new_from_file_at_scale [as 别名]
 def resizeImage(self, widget, rectangle):
     if self.settingsManager.resizeImage and self.currentBooru.getCurrentFile():
         iWidth = rectangle.width - 15
         iHeight = rectangle.height - 15
         mpixbuf = Pixbuf.new_from_file_at_scale(self.currentBooru.getCurrentFile(), iWidth, iHeight, True)
         self.iCurHeight = iHeight
         self.iCurWidth = iWidth
         Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.GtkSetImage, mpixbuf)
开发者ID:swag4swag,项目名称:pybooru,代码行数:10,代码来源:main.py

示例4: getIcon

# 需要导入模块: from gi.repository.GdkPixbuf import Pixbuf [as 别名]
# 或者: from gi.repository.GdkPixbuf.Pixbuf import new_from_file_at_scale [as 别名]
def getIcon(name, mime = None, size = None):
    d = os.path.join(r, 'icons')
    
    if mime == None:
        mime = 'png'
        
    n = ".".join([name, mime])
    p = os.path.join(d, n)
    
    if size == None:
        i = Pixbuf.new_from_file(p)
    else:
        i = Pixbuf.new_from_file_at_scale(p, size, size, False)
        
    return i
开发者ID:jeremi360,项目名称:Crowbar,代码行数:17,代码来源:functions.py

示例5: split

# 需要导入模块: from gi.repository.GdkPixbuf import Pixbuf [as 别名]
# 或者: from gi.repository.GdkPixbuf.Pixbuf import new_from_file_at_scale [as 别名]
    bin_path = split(argv[0])[0]
    icons_path = "icons/formiko.svg"
    share_path = join("share/formiko", icons_path)
    while (bin_path != '/'):
        # this work to /opt /usr /usr/local prefixes
        if exists(join(bin_path, share_path)):
            return join(bin_path, share_path)
        if exists(join(bin_path, icons_path)):
            return join(bin_path, icons_path)
        bin_path = split(bin_path)[0]


ICON_PATH = get_path()

if ICON_PATH:
    icon_16 = Pixbuf.new_from_file_at_scale(ICON_PATH, 16, 16, True)
    icon_32 = Pixbuf.new_from_file_at_scale(ICON_PATH, 32, 32, True)
    icon_48 = Pixbuf.new_from_file_at_scale(ICON_PATH, 48, 48, True)
    icon_64 = Pixbuf.new_from_file_at_scale(ICON_PATH, 64, 64, True)
    icon_128 = Pixbuf.new_from_file_at_scale(ICON_PATH, 128, 128, True)
else:
    from gi.repository.Gtk import IconTheme
    from gi.repository.GLib import log_default_handler, LogLevelFlags

    log_default_handler("Application", LogLevelFlags.LEVEL_ERROR,
                        "Formiko icon not found", 0)
    icon_theme = IconTheme.get_default()
    icon_16 = icon_theme.load_icon("text-editor-symbolic", 16, 0)
    icon_32 = icon_theme.load_icon("text-editor-symbolic", 32, 0)
    icon_48 = icon_theme.load_icon("text-editor-symbolic", 48, 0)
    icon_64 = icon_theme.load_icon("text-editor-symbolic", 64, 0)
开发者ID:ondratu,项目名称:formiko,代码行数:33,代码来源:icons.py


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