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


Python Screen.draw_circle方法代码示例

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


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

示例1: EyeTribeTracker

# 需要导入模块: from pygaze.screen import Screen [as 别名]
# 或者: from pygaze.screen.Screen import draw_circle [as 别名]

#.........这里部分代码省略.........
			if quited:
				# show retry message
				self.screen.clear()
				self.screen.draw_text("Calibration aborted. Press Space to restart, or 'Q' to quit.")
				self.disp.fill(self.screen)
				self.disp.show()
				# get input
				key, keytime = self.kb.get_key(keylist=['q','space'], timeout=None, flush=True)
				if key == 'space':
					# unset quited Boolean
					quited = False
				# skip further processing
				continue

			# get the calibration result if it was not obtained yet
			if type(calibresult) != dict:
				# empty display
				self.disp.fill()
				self.disp.show()
				# allow for a bit of calculation time
				clock.pause(2000)
				# get the result
				calibresult = self.eyetribe._tracker.get_calibresult()

			# results
			# clear the screen
			self.screen.clear()
			# draw results for each point
			if type(calibresult) == dict:
				for p in calibresult['calibpoints']:
					# only draw the point if data was obtained
					if p['state'] > 0:
						# draw the mean error
						self.screen.draw_circle(colour=(252,233,79), pos=(p['cpx'],p['cpy']), r=p['mepix'], pw=0, fill=True)
						# draw the point
						self.screen.draw_fixation(fixtype='dot', colour=(115,210,22), pos=(p['cpx'],p['cpy']))
						# draw the estimated point
						self.screen.draw_fixation(fixtype='dot', colour=(32,74,135), pos=(p['mecpx'],p['mecpy']))
						# annotate accuracy
						self.screen.draw_text(text=str(p['acd']), pos=(p['cpx']+10,p['cpy']+10), fontsize=12)
					# if no data was obtained, draw the point in red
					else:
						self.screen.draw_fixation(fixtype='dot', colour=(204,0,0), pos=(p['cpx'],p['cpy']))
				# draw box for averages
				self.screen.draw_rect(colour=(238,238,236), x=int(self.dispsize[0]*0.15), y=int(self.dispsize[1]*0.2), w=400, h=200, pw=0, fill=True)
				# draw result
				if calibresult['result']:
					self.screen.draw_text(text="calibration is successful", colour=(115,210,22), pos=(int(self.dispsize[0]*0.25),int(self.dispsize[1]*0.25)), fontsize=12)
				else:
					self.screen.draw_text(text="calibration failed", colour=(204,0,0), pos=(int(self.dispsize[0]*0.25),int(self.dispsize[1]*0.25)), fontsize=12)
				# draw average accuracy
				self.screen.draw_text(text="average error = %.2f degrees" % (calibresult['deg']), colour=(211,215,207), pos=(int(self.dispsize[0]*0.25),int(self.dispsize[1]*0.25+20)), fontsize=12)
				# draw input options
				self.screen.draw_text(text="Press Space to continue, or 'R' to restart.", colour=(211,215,207), pos=(int(self.dispsize[0]*0.25),int(self.dispsize[1]*0.25+40)), fontsize=12)
			else:
				self.screen.draw_text(text="Calibration failed, press 'R' to try again.")
			# show the results
			self.disp.fill(self.screen)
			self.disp.show()
			# wait for input
			key, keytime = self.kb.get_key(keylist=['space','r'], timeout=None, flush=True)
			# process input
			if key == 'space':
				calibrated = True

		# calibration failed if the user quited
开发者ID:ajlambert,项目名称:PyGaze,代码行数:70,代码来源:libeyetribe.py

示例2:

# 需要导入模块: from pygaze.screen import Screen [as 别名]
# 或者: from pygaze.screen.Screen import draw_circle [as 别名]
# # # # #
# test Screen

scr.clear()
scr.draw_text("We're now going to test the screen module. Press Space to start!")
disp.fill(scr)
t1 = disp.show()
log.write(["Screem", t1])
kb.get_key()

#scr.copy()
# scr.draw_circle()
scr.clear()
scr.draw_text("There should be two circles on the screen: \
\nred filled on the left, and green unfilled on the right", pos=(DISPSIZE[0]/2, DISPSIZE[1]/4))
scr.draw_circle(colour=(255,0,0), pos=(DISPSIZE[0]*0.25,DISPSIZE[1]/2), r=DISPSIZE[0]/10, pw=5, fill=True)
scr.draw_circle(colour=(0,255,0), pos=(DISPSIZE[0]*0.75,DISPSIZE[1]/2), r=DISPSIZE[0]/10, pw=5, fill=False)
disp.fill(scr)
disp.show()
kb.get_key()

#scr.draw_ellipse()
scr.clear()
scr.draw_text("There should be two ellipses on the screen: \
\nred filled on the left, and green unfilled on the right", pos=(DISPSIZE[0]/2, DISPSIZE[1]/4))
scr.draw_ellipse(colour=(255,0,0), x=DISPSIZE[0]*0.25, y=DISPSIZE[1]/2, w=DISPSIZE[0]/10, h=DISPSIZE[0]/5, pw=5, fill=True)
scr.draw_ellipse(colour=(0,255,0), x=DISPSIZE[0]*0.75, y=DISPSIZE[1]/2, w=DISPSIZE[0]/10, h=DISPSIZE[0]/5, pw=5, fill=False)
disp.fill(scr)
disp.show()
kb.get_key()
开发者ID:AA33,项目名称:PyGaze,代码行数:32,代码来源:PyGaze_supertest.py


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