本文整理汇总了Python中resource.get_image函数的典型用法代码示例。如果您正苦于以下问题:Python get_image函数的具体用法?Python get_image怎么用?Python get_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_image函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, xml_path, actual_value, max_value, x, y):
parse = xml.dom.minidom.parse(data.get_path_xml(xml_path))
bar = parse.getElementsByTagName('bar')
image_code = str(bar[0].getAttribute('image_code'))
self.bar_image = resource.get_image(image_code)
self.bar_rect = self.bar_image.get_rect()
self.bar_rect.x = x
self.bar_rect.y = y
controler = parse.getElementsByTagName('controler')
image_code = str(controler[0].getAttribute('image_code'))
self.controler_image = resource.get_image(image_code)
self.controler_rect = self.controler_image.get_rect()
self.controler_rect.centerx = self.bar_rect.centerx
self.controler_rect.centery = self.bar_rect.centery
font = parse.getElementsByTagName('font')
font_code = str(font[0].getAttribute('font_code'))
self.font = resource.get_font(font_code, 30)
r = int(font[0].getAttribute('r'))
g = int(font[0].getAttribute('g'))
b = int(font[0].getAttribute('b'))
self.color_font = (r,b,g)
self.max_value = max_value
self.actual_value = actual_value
self.update_controler()
self.still_pressed = False
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:33,代码来源:slider.py
示例2: __init__
def __init__(self, text, x, y, normal_image_code, selected_image_code, font_code, center = False):
self.normal_image = resource.get_image(normal_image_code)
self.selected_image = resource.get_image(selected_image_code)
self.rect = self.normal_image.get_rect()
if center:
self.rect.centerx = x
self.rect.centery = y
self.centerx = x
self.centery = y
else:
self.rect.x = x
self.rect.y = y
self.centerx = self.rect.w - seef.rect.x
self.centery = self.rect.h - seef.rect.y
self.mask = pygame.mask.from_surface(self.normal_image)
self.list_rect = self.mask.get_bounding_rects()
self.font = resource.get_font(font_code, 40)
self.font2 = resource.get_font(font_code, 45)
self.text = text
self.selected = False
self.change = True
self.text_render_normal = self.font.render("Prueba", True, (248, 179, 51))
self.text_render_selected = self.font2.render("Prueba", True, (188, 8, 37))
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:25,代码来源:button_v1.py
示例3: __init__
def __init__(self, frame, content_view):
# height = frame.size[1] + SCROLL_BUTTON_HEIGHT * 2
# rect = pygame.Rect(frame.x, frame.y - SCROLL_BUTTON_HEIGHT, frame.w, height)
rect = frame
self.selected_index = None
object_rectangle.ObjectRectangle.__init__(self, rect)
self.content_frame = ScrollFrame(pygame.Rect(0, SCROLL_BUTTON_HEIGHT, frame.w, frame.h - SCROLL_BUTTON_HEIGHT * 2), content_view)
self.content_view = content_view
self._content_offset = (0, 0)
# self.up_btn = button.Button(pygame.Rect(0, 0, rect.w, SCROLL_BUTTON_HEIGHT), u"△")
# self.up_btn.border_widths = None
self.up_image = resource.get_image("up")
self.up_btn = imagebutton.ImageButton(pygame.Rect(0, 0, rect.w, SCROLL_BUTTON_HEIGHT), self.up_image, pygame.Rect(0, 0, SCROLL_BUTTON_HEIGHT * 2, SCROLL_BUTTON_HEIGHT * 2))
self.up_btn.on_clicked.connect(self.up)
# self.down_btn = button.Button(pygame.Rect(0, rect.h - SCROLL_BUTTON_HEIGHT, rect.w, SCROLL_BUTTON_HEIGHT), u"▽")
# self.down_btn.border_widths = None
self.down_image = resource.get_image("down")
self.down_btn = imagebutton.ImageButton(pygame.Rect(0, rect.h - SCROLL_BUTTON_HEIGHT, rect.w, SCROLL_BUTTON_HEIGHT), self.down_image, pygame.Rect(0, 0, SCROLL_BUTTON_HEIGHT * 2, SCROLL_BUTTON_HEIGHT * 2))
self.down_btn.on_clicked.connect(self.down)
self.items = []
self.items.append(self.up_btn)
self.items.append(self.down_btn)
self.items.append(self.content_frame)
self._selected = False
开发者ID:thiranohirano,项目名称:PygameUI-TFT-C-mini,代码行数:28,代码来源:scroll.py
示例4: __init__
def __init__(self, xml_path):
parser = xml.dom.minidom.parse(data.get_path_xml("cursor.xml"))
root = parser.firstChild
self.normal_image = resource.get_image(root.getAttribute("normal_image"))
self.over_image = resource.get_image(root.getAttribute("over_image"))
self.actual_image = self.normal_image
self.x = self.y = 0
self.update()
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:10,代码来源:cursor.py
示例5: __init__
def __init__(self, player, path_xml, is_ia = False):
'''
@brief Constructor.
@param player Referencia al jugador.
@param path_xml Ruta del archivo xml
'''
self.player = player
parse = xml.dom.minidom.parse(data.get_path_xml(path_xml))
#Obtenemos la imagen de fondo
image = parse.getElementsByTagName('image')[0]
image_code = image.getAttribute('image_code')
self.image = resource.get_image(image_code)
#Controla los misiles restantes
self.missile = 0
#Fuente para mostrar los misiles restantes
self.font = resource.get_font('cheesebu', 40)
#Posicion de la imagen de fondo
self.centerx = int(image.getAttribute('centerx'))
self.centery = int(image.getAttribute('centery'))
self.position_image = self.image.get_rect()
self.position_image.centerx = self.centerx
self.position_image.centery = self.centery
#Mapa para los items
self.items = {}
self.is_ia = is_ia
#Recorremos cada uno de los items
for element in parse.getElementsByTagName('item'):
code = element.getAttribute('code')
self.items[code] = {}
self.items[code]['image'] = None
self.items[code]['xml'] = None
#Nos quedamos con su imagen de muestra
image_code = element.getAttribute('image_code')
self.items[code]['image'] = resource.get_image(image_code)
#Y con su archivo xml de configuración
path_xml = element.getAttribute('path_xml')
self.items[code]['xml'] = path_xml
if self.is_ia and 'turbo' in self.items.keys():
del self.items['turbo']
#En un principio no tenemos ningun item
self.actual_item = None
self.temp_angle = None
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:55,代码来源:basiccar.py
示例6: parser_car_info
def parser_car_info(self, parse):
'''
@brief Método que parsea la información básica de los coches.
'''
parent_node = parse.firstChild
self.name_character = parent_node.getAttribute('name_character')
self.avatar = resource.get_image(parent_node.getAttribute('avatar'))
self.racer_image = resource.get_image(parent_node.getAttribute('racer_image'))
self.max_speed = float(parent_node.getAttribute('max_speed'))
self.original_max_speed = float(parent_node.getAttribute('max_speed'))
self.min_speed = float(parent_node.getAttribute('min_speed'))
self.rotation_angle = float(parent_node.getAttribute('rotation_angle'))
self.aceleration = float(parent_node.getAttribute('aceleration'))
self.desaceleration = float(parent_node.getAttribute('desaceleration'))
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:14,代码来源:basiccar.py
示例7: __init__
def __init__(self, xml_path, actual_value, max_value, x, y, option = ''):
'''
@brief Constructor.
@param xml_path Ruta del archivo xml.
@param actual_value Valor actual que tendrá
@param max_value Valor máximo que puede alcanzar
@param x Posición en el eje x
@param y Posición en el eje y
'''
parse = xml.dom.minidom.parse(data.get_path_xml(xml_path))
bar = parse.getElementsByTagName('bar')
#Obtenemos la imagen que representará la barra
image_code = str(bar[0].getAttribute('image_code'))
self.bar_image = resource.get_image(image_code)
#Indicamos su posicion
self.bar_rect = self.bar_image.get_rect()
self.bar_rect.x = x
self.bar_rect.y = y
#Obtenemos la imagen que representará al controlador
controler = parse.getElementsByTagName('controler')
image_code = str(controler[0].getAttribute('image_code'))
self.controler_image = resource.get_image(image_code)
#Indicamos su posición inicial
self.controler_rect = self.controler_image.get_rect()
self.controler_rect.centerx = self.bar_rect.centerx
self.controler_rect.centery = self.bar_rect.centery
#Cargamos la fuente con la que se representará el valor
font = parse.getElementsByTagName('font')
font_code = str(font[0].getAttribute('font_code'))
self.font = resource.get_font(font_code, 30)
r = int(font[0].getAttribute('r'))
g = int(font[0].getAttribute('g'))
b = int(font[0].getAttribute('b'))
self.color_font = (r, b, g)
self.max_value = max_value
self.min_value = 0
self.actual_value = actual_value
self.update_controler()
self.still_pressed = self.new_pressed = False
self.option = option
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:48,代码来源:slider.py
示例8: __init__
def __init__(self, father, xml_path):
'''
@brief Constructos.
@param father Estado padre
@param xml_path Ruta archivo xml con la configuración
'''
ClassificationMenu.__init__(self, father, xml_path)
self.player = None
self.total_time = None
self.total_improved = None
self.fast_lap = None
self.lap_improved = None
self.all_laps = None
self.total_text = self.font.render('Tiempo total', True, (0, 0, 0))
self.lap_text = self.font.render('Mejor Vuelta', True, (0, 0, 0))
self.all_laps_text = self.font.render('Tiempos por vuelta', True,
(0, 0, 0))
self.tiny_font = resource.get_font('cheesebu', 10)
self.big_font = resource.get_font('cheesebu', 60)
self.positions = {1: self.tiny_font.render('st', True, (189, 9, 38)),
2: self.tiny_font.render('nd', True, (189, 9, 38)),
3: self.tiny_font.render('rd', True, (189, 9, 38)),
4: self.tiny_font.render('th', True, (189, 9, 38))}
self.record_image = resource.get_image('new_record')
self.record_total_image = pygame.transform.rotozoom(self.record_image, 30, 1)
self.record_lap_image = pygame.transform.rotozoom(self.record_image, 30, 0.7)
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:29,代码来源:classificationmenu.py
示例9: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.__actual_state = None
###########PRUEBA DE CIRCUIT###########
self.circuit = circuit.Circuit(None, 'mapa1.tmx')
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:28,代码来源:game.py
示例10: __init__
def __init__(self, menu, xml_file, text, centerx, centery, font_code, image_code, image_x, image_y, show_text=True):
"""
@brief Constructor
@param xml_file Ruta del archivo xml con la configuración básica
@param text Texto con la opción del botón
@param centerx Posicion del centro de la x del botón
@param centery Posicion del centro de la y del botón
@param font_code Código de la fuente a usar
@param image_code Código de la imagen a usar
@param image_x Posición x de la imagen respecto al botón
@param image_y Posición y de la imagen respecto al botón
@param show_text Indica si se debe mostrar el texto o no
"""
button.Button.__init__(self, menu, xml_file, text, centerx, centery, font_code, show_text)
# Si se muestra el texto y no es sobre el botón, asignamos la posición
if self.show_text:
if not self.on_button:
self.normal_text_rect.x += self.rect_draw.x
self.normal_text_rect.y += self.rect_draw.y
# Obtenemos la imagen del botón
self.image = resource.get_image(image_code)
# Obtenemos posición de la imagen
self.rect_image = self.image.get_rect()
self.rect_image.x = image_x + self.rect_draw.x
self.rect_image.y = image_y + self.rect_draw.y
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:29,代码来源:imagebutton.py
示例11: __init__
def __init__(self, game_control, circuit, x, y, image_code, orientation, car_angle):
"""
@brief Constructor.
@param game_control Referencia a GameControl
@param circuit Referencia a Circuit
@param x Posición en el eje x
@param y Posición en el eje y
@param image_code Código de la imagen(será del mismo ancho y algo que
los tiles de circuito)
@param orientation Indica si la linea será horizontal o vertical
@param car_angle angulo para situar al coche
"""
# Referencias
self.game_control = game_control
self.circuit = circuit
# Posición
self.x = x
self.y = y
# Imagen
self.image = resource.get_image(image_code)
self.orientation = orientation
self.car_angle = car_angle
if config.Config().get_mode() == config.TIMED:
self.place_player()
else:
self.place_cars()
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:32,代码来源:start.py
示例12: __init__
def __init__(self, image, action = None, enable = None, **kwds):
if isinstance(image, basestring):
image = resource.get_image(image)
if image:
self.image = image
BaseButton.__init__(self, action, enable)
Widget.__init__(self, image.get_rect(), **kwds)
开发者ID:FinnStokes,项目名称:orpheus,代码行数:7,代码来源:controls.py
示例13: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.__actual_state = None
######PRUEBA MODULO PLAYER CAR##########
self.car = playercar.PlayerCar("juego", 'coche_prueba.xml', 400, 300, 180)
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:28,代码来源:game.py
示例14: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
os.environ["SDL_VIDEO_CENTERED"] = "1"
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.mouse.set_visible(False)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.font = resource.get_font('cheesebu', 30)
keyboard.update()
######PRUEBA MODULO GAME CONTROL##########
self.__actual_state = gamecontrol.GameControl(self, 'circuits/circuit1-beach.tmx')
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:32,代码来源:game.py
示例15: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.mouse.set_visible(False)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.__actual_state = mainmenu.MainMenu(self, 'menu/mainmenu.xml')
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:25,代码来源:game.py
示例16: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.__exit = False
self.__actual_state = None
## A partir de aqui las variables no pertenecen a la clase game
## Si no para realizar las pruebas necesarias de la clase animation
self.granny = resource.get_sprite('granny')
self.walk = animation.Animation("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30", 1)
self.jump = animation.Animation("49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64", 1)
self.attack = animation.Animation("64,65,67,68,69,70,71,72,73,74,75,76,77,78,79,80", 1)
self.actual_animation = self.walk
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:34,代码来源:game.py
示例17: __init__
def __init__(self, frame, img, content_mode=SCALE_TO_FIT):
"""Create an image view from an image.
frame.topleft
where to position the view.
frame.size
if (0, 0) the frame.size is set to the image's size;
otherwise, the image is scaled to this size.
"""
if img == None:
img = resource.get_image('images/default_cover_art.png')
assert img is not None
if frame is None:
frame = pygame.Rect((0, 0), img.get_size())
elif frame.w == 0 and frame.h == 0:
frame.size = img.get_size()
view.View.__init__(self, frame)
self._enabled = False
self.content_mode = content_mode
self.image = img
开发者ID:jwayneroth,项目名称:mpd-touch,代码行数:29,代码来源:imageview.py
示例18: __init__
def __init__(self):
'''
Carga e inicializa la configuración principal y las variables principales de la clase
'''
parser = xml.dom.minidom.parse(data.get_path_xml('configuration.xml'))
for element in parser.getElementsByTagName('screen'):
self.__screen_width = int(element.getAttribute('width'))
self.__screen_height = int(element.getAttribute('height'))
self.caption = element.getAttribute('caption')
for element in parser.getElementsByTagName('fps'):
self.fps = int(element.getAttribute('value'))
pygame.init()
self.screen = pygame.display.set_mode((self.__screen_width, self.__screen_height))
for element in parser.getElementsByTagName('icon'):
icon_code = str(element.getAttribute('code'))
self.icon = resource.get_image(icon_code)
pygame.display.set_icon(self.icon)
self.clock = pygame.time.Clock()
self.__actual_state = None
self.button = button.Button("menu/mainoption1.xml", "Prueba", 400, 300, 'cheesebu', True)
self.button2 = button.Button("menu/mainoption2.xml", "Prueba2lslsls", 400, 365, 'cheesebu', False)
self.button3 = button.Button("menu/mainoption1.xml", "Prueba3", 400, 405, 'cheesebu', True)
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:28,代码来源:game.py
示例19: __init__
def __init__(self, game, xml_file):
state.State.__init__(self, game)
parser = xml.dom.minidom.parse(data.get_path_xml(xml_file))
self.speed = int(parser.firstChild.getAttribute('speed'))
self.actual_alpha = 0
self.surface = pygame.Surface((pygame.display.get_surface().get_width(), pygame.display.get_surface().get_height()))
for element in parser.getElementsByTagName('image'):
image_code = str(element.getAttribute('imagecode'))
x = int(element.getAttribute('x'))
y = int(element.getAttribute('y'))
image = resource.get_image(image_code)
self.surface.blit(image, (x,y))
self.surface.set_alpha(self.actual_alpha)
self.to_opaque = True
self.quit = False
开发者ID:BGCX262,项目名称:zycars-svn-to-git,代码行数:25,代码来源:intro.py
示例20: update_image
def update_image (self) :
direction = self._direction
should_use_running_anim = self._running
should_use_walking_anim = self._walking
should_use_standing_anim = True
key = None
if self._jumping :
key = self._images['jump']
should_use_running_anim = False
should_use_walking_anim = False
should_use_standing_anim = False
if should_use_running_anim :
self._running_duration += 1
if (self._running_duration < running_anim_duraction) :
key = self._images['run']
should_use_walking_anim = False
should_use_standing_anim = False
if should_use_walking_anim :
self._walking_duration += 1
if (self._walking_duration < walking_anim_duration) :
key = self._images['walk']
should_use_standing_anim = False
if should_use_standing_anim :
key = self._images['stand']
if self._running_duration > 2*running_anim_duraction :
self._running_duration = 0
if self._walking_duration > 2*walking_anim_duration :
self._walking_duration = 0
self.image = resource.get_image (key)
if self._direction == Direction.left :
key += 'flip'
if resource.has_image (key) :
self.image = resource.get_image (key)
else :
self.image = pygame.transform.flip (self.image, True, False).convert()
resource.set_image (key, self.image)
self.image.set_colorkey ((255,255,255))
开发者ID:ccl2of4,项目名称:Zombie-Hunting,代码行数:47,代码来源:character.py
注:本文中的resource.get_image函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论