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


Python Graphics.artist_field方法代码示例

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


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

示例1: __init__

# 需要导入模块: from graphics import Graphics [as 别名]
# 或者: from graphics.Graphics import artist_field [as 别名]
class Interface:

	def __init__(self):
		# init graphic library
		self.graphics = Graphics()

	def main_interface(self, screen, book):
		''' drawing the main interface to screen '''
		# create background
		screen.fill(GREY)
		screen.blit(self.graphics.load_image(BG_IMG), (0, 0))
		# create continue playing field
		self.graphics.clock(screen)
		self.graphics.seperator_line(screen, 120)
		self.graphics.continue_playback(screen, 200, 50, 300, 120, 20, 
			book.get_cover(), book.get_title())
		# add seperator line
		self.graphics.seperator_line(screen)
		# add button for library
		self.graphics.menu_button(screen, "New Book", 10, 190, 48, 48, 
			30, LIBRARY)
		# add exit button
		self.graphics.menu_button(screen, "", 265, 190, 48, 48, 
			30, EXIT)
		return screen

	def list_interface(self, screen, title, artist, playtime, cover):
		''' generate screen for library interface '''
		# create background
		screen.fill(GREY)
		screen.blit(self.graphics.load_image(BG_IMG), (0, 0))
		# load button images
		back = self.graphics.load_image(BACK)
		left = self.graphics.load_image(LEFT)
		right = self.graphics.load_image(RIGHT)
		select = self.graphics.load_image(SELECT)
		# add seperator line
		self.graphics.seperator_line(screen)
		# draw navigation buttons to screen
		self.graphics.image_button(screen, back, 10, 190, 48, 48)
		self.graphics.image_button(screen, left, 155, 190, 48, 48)
		self.graphics.image_button(screen, right, 210, 190, 48, 48)
		self.graphics.image_button(screen, select, 265, 190, 48, 48)
		# update actual audio book informations
		self.graphics.title_field(screen, title, 10, 10, 300)
		self.graphics.artist_field(screen, artist, 10, 45)
		self.graphics.play_time_field(screen, playtime, 10, 100)
		self.graphics.cover_field(screen, cover, 140, 140, 155, 40)  
		return screen

	def player_interface(self, screen, title, artist, actualChapter, totalChapter,
		playtime, music_pos, cover):
		''' generate the interface for the audio player '''
		# create background
		screen.fill(GREY)
		screen.blit(self.graphics.load_image(BG_IMG), (0, 0))
		# load images for buttons
		back = self.graphics.load_image(BACK)
		backward = self.graphics.load_image(PREVIOUS)
		forward = self.graphics.load_image(NEXT)
		pause = self.graphics.load_image(PAUSE)
		play = self.graphics.load_image(PLAY)
		stop = self.graphics.load_image(STOP)
		# add seperator line
		self.graphics.seperator_line(screen)
		# draw navigation buttons to screen a
		self.graphics.image_button(screen, back, 10, 190, 48, 48)
		# draw playback buttons to screen
		self.graphics.image_button(screen, backward, 65, 190, 48, 48)
		self.graphics.image_button(screen, forward, 115, 190, 48, 48)
		self.graphics.image_button(screen, pause, 165, 190, 48, 48)
		self.graphics.image_button(screen, stop, 215, 190, 48, 48)
		self.graphics.image_button(screen, play, 265, 190, 48, 48)
		# update actual audio book informations
		self.graphics.title_field(screen, title, 10, 10, 300)
		self.graphics.artist_field(screen, artist, 10, 45)
		self.graphics.chapter_field(screen, actualChapter, totalChapter, 10, 100)
		self.graphics.cover_field(screen, cover, 80, 80, 220, 40)
		self.graphics.play_bar(screen, playtime, music_pos)
		return screen

	def exit_interface(self, screen):
		''' draw an little exit screen containing an exit message '''
		while True:
			# draw background
			screen.fill(GREY)
			# set a bigger font
			font = pygame.font.Font(None, 45)
			# draw exit message
			label = font.render("Good Bye!", 1, (WHITE))
			screen.blit(label, (85,100))
			# update display
			pygame.display.flip()
			# show message for to seconds and exit program
			time.sleep(2)
			sys.exit(0)
开发者ID:psikon,项目名称:pitft-scripts,代码行数:98,代码来源:interfaces.py


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