本文整理汇总了Python中scene.Scene.set_trace_len方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.set_trace_len方法的具体用法?Python Scene.set_trace_len怎么用?Python Scene.set_trace_len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.set_trace_len方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: App
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import set_trace_len [as 别名]
#.........这里部分代码省略.........
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) :
gtk.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_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_but_quit_clicked(self,widget,data=None):
gtk.main_quit()
def on_cb_wireframe_toggled(self,widget,data=None):
self.scene.toggle_wireframe()
def on_cb_solid_toggled(self,widget,data=None):
self.scene.toggle_solid()
def on_cb_gravity_toggled(self,widget,data=None):
self.scene.toggle_gravity()
def on_trace_value_changed(self,widget,data=None):
self.scene.set_trace_len( widget.get_value() )
def on_set_dens(self,widget,data=None):
self.scene.set_dens(widget.get_value())
def on_set_x(self,widget,data=None):
self.scene.set_x(widget.get_value())
def on_set_y(self,widget,data=None):
self.scene.set_y(widget.get_value())
def on_set_z(self,widget,data=None):
self.scene.set_z(widget.get_value())
def on_set_a(self,widget,data=None):
self.scene.set_a(widget.get_value())
def on_set_w(self,widget,data=None):
self.scene.set_w(widget.get_value())
def on_reset(self,widget,data=None):
self.scene.reset()