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


Python Scene.set_R方法代码示例

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


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

示例1: App

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import set_R [as 别名]

#.........这里部分代码省略.........

	def update_statusbar( self ) :
		pass

	def _on_reshape( self , widget , data=None ) :
		width = self.drawing_area.allocation.width
		height = self.drawing_area.allocation.height

		ratio = float(width)/float(height)

		self.scene.set_screen_size( width , height )

	def _on_button_pressed( self , widget , data=None ) :
		if data.button == 1 or data.button == 2 or data.button == 3 :
			self.mouse_pos = data.x , data.y
		self.button[data.button] = True
		self.drawing_area.queue_draw()

	def _on_button_released( self , widget , data=None ) :
		self.button[data.button] = False


	def _on_mouse_motion( self , widget , data=None ) :
		diff = map( op.sub , self.mouse_pos , (data.x , data.y) )

		self.scene.mouse_move( diff , self.button )

		self.mouse_pos = data.x , data.y
		self.drawing_area.queue_draw()

	def _on_key_pressed( self , widget , data=None ) :
		if not any(self.move) :
			gobject.timeout_add( 20 , self._move_callback )

		for i in range(len(self.dirskeys)) :
			if (data.keyval,False) in self.dirskeys[i][0] :
				self.dirskeys[i][0][ self.dirskeys[i][0].index( (data.keyval,False) ) ] = (data.keyval,True)
				self.move[i]+= 1
			elif (data.keyval,False) in self.dirskeys[i][1] :
				self.dirskeys[i][1][ self.dirskeys[i][1].index( (data.keyval,False) ) ] = (data.keyval,True)
				self.move[i]-= 1

	
	def _on_key_released( self , widget , data=None ) :
		for i in range(len(self.dirskeys)) :
			if (data.keyval,True) in self.dirskeys[i][0] :
				self.dirskeys[i][0][ self.dirskeys[i][0].index( (data.keyval,True) ) ] = (data.keyval,False)
				self.move[i]-= 1
			elif (data.keyval,True) in self.dirskeys[i][1] :
				self.dirskeys[i][1][ self.dirskeys[i][1].index( (data.keyval,True) ) ] = (data.keyval,False)
				self.move[i]+= 1

	def _move_callback( self ) :
		self.scene.key_pressed( self.move )
		self.drawing_area.queue_draw()
		return any(self.move)

	def init_glext(self):
		# Query the OpenGL extension version.
#        print "OpenGL extension version - %d.%d\n" % gtk.gdkgl.query_version()

		# Configure OpenGL framebuffer.
		# Try to get a double-buffered framebuffer configuration,
		# if not successful then try to get a single-buffered one.
		display_mode = (
				gtk.gdkgl.MODE_RGB    |
				gtk.gdkgl.MODE_DEPTH  |
				gtk.gdkgl.MODE_STENCIL|
				gtk.gdkgl.MODE_DOUBLE )
		try:
			glconfig = gtk.gdkgl.Config(mode=display_mode)
		except gtk.gdkgl.NoMatches:
			display_mode &= ~gtk.gdkgl.MODE_DOUBLE
			glconfig = gtk.gdkgl.Config(mode=display_mode)

#        print "is RGBA:",                 glconfig.is_rgba()
#        print "is double-buffered:",      glconfig.is_double_buffered()
#        print "is stereo:",               glconfig.is_stereo()
#        print "has alpha:",               glconfig.has_alpha()
#        print "has depth buffer:",        glconfig.has_depth_buffer()
#        print "has stencil buffer:",      glconfig.has_stencil_buffer()
#        print "has accumulation buffer:", glconfig.has_accum_buffer()
#        print

		return glconfig

	def on_win_main_destroy(self,widget,data=None):
		gtk.main_quit()
		 
	def on_quit(self,widget,data=None):
		gtk.main_quit()

	def on_w_changed(self,widget,data=None):
		self.scene.set_w(widget.get_value())
	def on_L_changed(self,widget,data=None):
		self.scene.set_L(widget.get_value())
	def on_R_changed(self,widget,data=None):
		self.scene.set_R(widget.get_value())
	def on_eps_changed(self,widget,data=None):
		self.scene.set_eps(widget.get_value())
开发者ID:jkotur,项目名称:piston,代码行数:104,代码来源:hodograph.py


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