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


Python Screen.draw_line方法代码示例

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


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

示例1: range

# 需要导入模块: from pygaze.screen import Screen [as 别名]
# 或者: from pygaze.screen.Screen import draw_line [as 别名]
tracker.calibrate()

# starting screen
scr.clear()
scr.draw_text(text="Press Space to start")

disp.fill(scr)
disp.show()
kb.get_key(keylist=['space'], timeout=None, flush=True)


# # # # #
# VALIDATION horizontal

scr.clear()
scr.draw_line((0,0,0), (int(0.05*DISPSIZE[0]),int(0.15*DISPSIZE[1])), (int(0.95*DISPSIZE[0]),int(0.15*DISPSIZE[1])), 1)
scr.draw_line((0,0,0), (int(0.95*DISPSIZE[0]),int(0.15*DISPSIZE[1])), (int(0.95*DISPSIZE[0]),int(0.5*DISPSIZE[1])), 1)
scr.draw_line((0,0,0), (int(0.95*DISPSIZE[0]),int(0.5*DISPSIZE[1])), (int(0.05*DISPSIZE[0]),int(0.5*DISPSIZE[1])), 1)
scr.draw_line((0,0,0), (int(0.05*DISPSIZE[0]),int(0.5*DISPSIZE[1])), (int(0.05*DISPSIZE[0]),int(0.85*DISPSIZE[1])), 1)
scr.draw_line((0,0,0), (int(0.05*DISPSIZE[0]),int(0.85*DISPSIZE[1])), (int(0.95*DISPSIZE[0]),int(0.85*DISPSIZE[1])), 1)

# loop through points
for i in range(len(CALIBPOINTShor)):
    # get coordinate
    x, y = CALIBPOINTShor[i]
        # draw calibration point
        scr.draw_fixation(fixtype='cross', pos=(x,y))

disp.fill(scr)
disp.show()
开发者ID:amywinecoff,项目名称:EyeTribe_test,代码行数:32,代码来源:experiment.py

示例2:

# 需要导入模块: from pygaze.screen import Screen [as 别名]
# 或者: from pygaze.screen.Screen import draw_line [as 别名]
#scr.draw_rect()
scr.clear()
scr.draw_text("There should be two rectangles on the screen: \
\nred filled on the left, and green unfilled on the right", pos=(DISPSIZE[0]/2, DISPSIZE[1]/4))
scr.draw_rect(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_rect(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()

#scr.draw_line()
scr.clear()
scr.draw_text("There should be three lines on the screen: \
\nred oblique on the left, green horizontal in the centre, and blue vertical on the right", pos=(DISPSIZE[0]/2, DISPSIZE[1]/4))
scr.draw_line(colour=(255,0,0), spos=(DISPSIZE[0]*0.20,DISPSIZE[1]*0.45), epos=(DISPSIZE[0]*0.30,DISPSIZE[1]*0.55), pw=5)
scr.draw_line(colour=(0,255,0), spos=(DISPSIZE[0]*0.45,DISPSIZE[1]/2), epos=(DISPSIZE[0]*0.55,DISPSIZE[1]/2), pw=5)
scr.draw_line(colour=(0,0,255), spos=(DISPSIZE[0]*0.75,DISPSIZE[1]*0.45), epos=(DISPSIZE[0]*0.75,DISPSIZE[1]*0.55), pw=5)
disp.fill(scr)
disp.show()
kb.get_key()

#scr.draw_polygon()
scr.clear()
scr.draw_text("There should be two polygons on the screen: \
\nred filled triangle on the left, and green unfilled hexagon on the right", pos=(DISPSIZE[0]/2, DISPSIZE[1]/4))
pl = [(DISPSIZE[0]*0.25, DISPSIZE[1]*0.45), (DISPSIZE[0]*0.2, DISPSIZE[1]*0.55), (DISPSIZE[0]*0.3, DISPSIZE[1]*0.55)]
scr.draw_polygon(pl, colour=(255,0,0), pw=5, fill=True)
# topleft, topright, centreright, bottomright, bottomleft, centreleft
pl = [(DISPSIZE[0]*0.70, DISPSIZE[1]*0.40), (DISPSIZE[0]*0.80, DISPSIZE[1]*0.40), (DISPSIZE[0]*0.85, DISPSIZE[1]*0.5), (DISPSIZE[0]*0.80, DISPSIZE[1]*0.60), (DISPSIZE[0]*0.70, DISPSIZE[1]*0.60), (DISPSIZE[0]*0.65, DISPSIZE[1]*0.5)]
scr.draw_polygon(pl, colour=(0,255,0), pw=5, fill=False)
开发者ID:AA33,项目名称:PyGaze,代码行数:32,代码来源:PyGaze_supertest.py

示例3: EyeTribeTracker

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

#.........这里部分代码省略.........
				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

			# empty display
			self.disp.fill()
			self.disp.show()
			# allow for a bit of calculation time
			# (this is waaaaaay too much)
			clock.pause(1000)
			# get the calibration result
			self.eyetribe._lock.acquire(True)
			calibresult = self.eyetribe._tracker.get_calibresult()
			self.eyetribe._lock.release()

			# 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)
						self.screen.draw_line(spos=(p['cpx'],p['cpy']),
							epos=(p['mecpx'],p['mecpy']), pw=2)
						# 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='%.2f' % p['acd'],
							pos=(p['cpx']+10,p['cpy']+10), fontsize=20)
					# 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 successful",
						colour='green',
						pos=(int(self.dispsize[0]*0.5), int(self.dispsize[1]*0.25)), 
						fontsize=20)
				else:
					self.screen.draw_text(text="Calibration failed",
						colour='red',
						pos=(int(self.dispsize[0]*0.5),int(self.dispsize[1]*0.25)),
						fontsize=20)
				# draw average accuracy
				self.screen.draw_text(
					text="Average error = %.2f degrees" % (calibresult['deg']),
					pos=(int(self.dispsize[0]*0.5),int(self.dispsize[1]*0.25+30)),
					fontsize=20)
开发者ID:Versatilus,项目名称:PyGaze,代码行数:70,代码来源:libeyetribe.py


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