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


Python Stack.setPos方法代码示例

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


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

示例1: Mediator

# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import setPos [as 别名]
class Mediator(Receiver,FocusObserver,NodePathWrapper):
    """The singleton mediatorobject mediates the interaction between the
    StoryMap objects, receiving notifications and calling methods on StoryMap
    objects.

    """
    def __init__(self):

        # Create two story maps, 'Story Cards' which the user picks story cards
        # from, and 'My Story Map' in which the user constructs her story.
        self.storyCards = StoryMap(storyCardClass=FocusableChoosableStoryCard, 
                                   title="Story Cards")
        self.storyCards.reparentTo(zcanvas.home)
        self.storyCards.setScale(0.02)
        self.storyCards.setPos(-.5,0,.8)
        self.storyCards.fill()
        self.storyCards.added_behaviour = 'disable'
        
        self.myStoryMap = StoryMap(storyCardClass=FocusableEditableStoryCard, 
                                   title="My Story")
        self.myStoryMap.reparentTo(zcanvas.home)
        self.myStoryMap.setScale(0.02)
        self.myStoryMap.setPos(-.5,0,-.1)
        self.myStoryMap.added_behaviour = 'remove'
        #self.myStoryMap.keep_sorted = True        
        #self.myStoryMap.np.showTightBounds()
        self.myStoryMap.auto_grow = True
               
        # Keyboard controls for saving, loading and exporting.
        #base.accept("f1",self.save)
        #base.accept("f2",self.load)
        #base.accept("f3",self.export)
        
        # Subscribe to some messages.
        self.acceptOnce('zoom done',zcanvas.message,["Right-click to zoom back out again."])
        self.accept('add',self.add)
        self.accept('remove',self.remove)

        # Frame along the bottom for Save, Load and Quit buttons.
        self.bottom_np = aspect2d.attachNewNode('bottom frame')
        height = 0.15
        self.bottom_np.setPos(-base.getAspectRatio(),0,-1-height)
        cm = CardMaker('bottom frame')
        cm.setFrame(0,2*base.getAspectRatio(),0,height)
        self.bottom_np.attachNewNode(cm.generate())
        self.bottom_np.setTransparency(TransparencyAttrib.MAlpha)
        self.bottom_np.setColor(.1,.1,.1,.7)
        self.bottom_hbox = HBoxList(margin=1)
        self.bottom_hbox.reparentTo(self.bottom_np)
        self.bottom_hbox.setPos(0,0,height-0.03)
        self.bottom_hbox.setScale(.1)    
        self.save_button = DirectButton(text="Save",command=self.save)
        b = Box()
        b.fill(self.save_button)
        self.bottom_hbox.append(b)
        self.load_button = DirectButton(text="Load",command=self.load)
        b = Box()
        b.fill(self.load_button)
        self.bottom_hbox.append(b)
        # Interval that slides the frame onto the screen.
        self.bottom_interval = LerpPosInterval(
                            self.bottom_np,
                            duration=1,
                            pos=Point3(-base.getAspectRatio(),0,-1),
                            startPos=Point3(-base.getAspectRatio(),0,-1-height),
                            other=None,
                            blendType='easeInOut',
                            bakeInStart=1,
                            fluid=0,
                            name=None)
        self.bottom_reverse_interval = LerpPosInterval(
                                 self.bottom_np,
                                 duration=1,
                                 pos=Point3(-base.getAspectRatio(),0,-1-height),
                                 startPos=Point3(-base.getAspectRatio(),0,-1),
                                 other=None,
                                 blendType='easeInOut',
                                 bakeInStart=1,
                                 fluid=0,
                                 name=None)
        self.bottom_frame_is_active = False

        # Frame along the right for story cards.
        self.right_np = aspect2d.attachNewNode('right frame')
        width = 0.14*base.getAspectRatio()
        self.right_np.setPos(base.getAspectRatio()+width,0,1)
        cm = CardMaker('right frame')
        cm.setFrame(-width,0,-2,0)
        self.right_np.attachNewNode(cm.generate())
        self.right_np.setTransparency(TransparencyAttrib.MAlpha)
        self.right_np.setColor(.1,.1,.1,.7)
        self.right_vbox = Stack()
        self.right_vbox.reparentTo(self.right_np)
        self.right_vbox.setPos(-width+0.035,0,-0.06)
        self.right_vbox.setScale(.02)
        # Interval that slides the frame onto the screen.
        self.right_interval = LerpPosInterval(
                               self.right_np,
                               duration=1,
                               pos=Point3(base.getAspectRatio(),0,1),
#.........这里部分代码省略.........
开发者ID:seanh,项目名称:PandaZUI,代码行数:103,代码来源:story.py


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