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


Python Box.setColor方法代码示例

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


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

示例1: __init__

# 需要导入模块: from box import Box [as 别名]
# 或者: from box.Box import setColor [as 别名]
    def __init__(self,function):

        self.function = function
        
        ZNode.__init__(self,geomnode=card(), magnification=.8)        
        self.np.setColor(1,1,1,1)
                
        Draggable.__init__(self)
        Highlightable.__init__(self)

        # Uncomment to apply a texture to the card.
        #tex = loader.loadTexture('card.png')
        #self.np.setTexture(tex)

        # Now to add the DirectGUI widgets onto the card. A StoryCard has two
        # VBoxes containing DirectGUI objects, one that is shown when the card
        # is far from the viewport and displaying itself in low detail, and one
        # that is shown when the viewport is focused on the card and the card is
        # showing itself in high detail.
        self.lowDetailVBox = VBoxList()
        self.highDetailVBox = VBoxList()
        self.lowDetailVBox.reparentTo(self.np)
        self.highDetailVBox.reparentTo(self.np)

        # The title of the function of this card.
        font = 'storymaps/data/TypeWritersSubstitute-Black.ttf'

        title = DirectLabel(text=self.function.name,
                            text_font=loader.loadFont(font),
                            text_bg=(1,1,1,0),
                            frameColor=(1,1,1,1),
                            scale=.7,
                            suppressMouse=0)
        b = Box()
        b.fill(title)                            
        self.lowDetailVBox.append(b)

        title = DirectLabel(text=self.function.name,
                            text_font=loader.loadFont(font),
                            text_bg=(1,1,1,0),
                            frameColor=(1,1,1,1),
                            scale=.7,
                            suppressMouse=0)
        b = Box()
        b.fill(title)                            
        self.highDetailVBox.append(b)

        # The icon of the function of this card. Use Panda's mipmapping
        # to handle scaling the image efficiently.
        tex = loader.loadTexture(function.image)
        tex.setMagfilter(Texture.FTLinearMipmapLinear)
        tex.setMinfilter(Texture.FTLinearMipmapLinear)

        icon = DirectLabel(image=tex)
        icon.setScale(2.5)
        b = Box()
        b.fill(icon)                            
        self.lowDetailVBox.append(b)

        icon = DirectLabel(image=tex)
        b = Box()
        b.fill(icon)                                    
        self.highDetailVBox.append(b)

        # The longer description of the Propp function.
        self.entry  = DirectEntry(initialText=self.function.desc,
                                 text_font=loader.loadFont('storymaps/data/WritersFont.ttf'),
                                 scale=.4,
                                 width=13,
                                 numLines=7,
                                 suppressMouse=0,
                                 frameColor = (1,1,1,1))
        self.entry['state'] = DGG.DISABLED

        b = Box()
        b.setColor(1,1,1,0)
        b.fill(self.entry)                            
        self.highDetailVBox.append(b)

        self.lowDetailVBox.setPos(self.lowDetailVBox.np,-2.6,0,4)
        self.highDetailVBox.setPos(self.lowDetailVBox.getPos())

        self.highDetailVBox.hide()

        # A place for subclasses to put buttons.
        self.buttons = HBoxList()             
        self.buttons.reparentTo(self.np)   
        self.buttons.setScale(.6)
        self.buttons.setPos(-1.8,0,-1.6)
        self.buttons.hide()

        self.disabled = False
开发者ID:seanh,项目名称:PandaZUI,代码行数:94,代码来源:storyCard.py


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