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


Python DirectScrolledList.reparentTo方法代码示例

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


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

示例1: MenuOptions

# 需要导入模块: from direct.gui.DirectGui import DirectScrolledList [as 别名]
# 或者: from direct.gui.DirectGui.DirectScrolledList import reparentTo [as 别名]
class MenuOptions(Menu):

    def __init__(self, _engine):
        """
        This function will initialise the main screen of the options
        and prepare the tabs with the various settings
        """
        Menu.__init__(self)

        # Engine
        self.engine = _engine

        self.initGeneralTab()
        self.initControlTab()

        self.currentTab = [0]

        self.tabGroup = [
            DirectRadioButton(
                text = _("General"),
                variable = self.currentTab,
                value = [0],
                scale = 0.05,
                pos = (-0.6, 0, 0.65),
                command = self.showGeneralTab),
            DirectRadioButton(
                text = _("Controls"),
                variable = self.currentTab,
                value = [1],
                scale = 0.05,
                pos = (0.6, 0, 0.65),
                command = self.showControlTab)
            ]

        for tab in self.tabGroup:
            tab.reparentTo(self.frameMain)
            tab.setOthers(self.tabGroup)

        # set the text of all GUI elements
        self.setText()

        self.hideBase()

    def initGeneralTab(self):
        """
        This function will set up the content of the
        general tab
        """
        self.frameGeneral = DirectFrame(
            # size of the frame
            frameSize = (base.a2dLeft, base.a2dRight,
                         -0.6, 0.6),
            # position of the frame
            pos = (0, 0, 0),
            # tramsparent bg color
            frameColor = (0, 0, 0, 0.5))

        yPos = 0.45
        shiftY = 0.25

        self.lblLanguage = DirectLabel(
            text = _("Language"),
            scale = 0.15,
            pos = (base.a2dLeft + 0.25, 0, yPos),
            frameColor = (0,0,0,0),
            text_fg = (1,1,1,1),
            #text_font = self.defaultFont,
            text_align = TextNode.ALeft)

        self.cmbLanguage = DirectOptionMenu(
            text = "languages",
            scale = 0.15,
            pos = (base.a2dRight - 1.5, 0, 0.45),
            items = ["Deutsch","English","русский", "français"],
            initialitem = 0,
            highlightColor = (0.65,0.65,0.65,1),
            #text_font = self.defaultFontRegular,
            #item_text_font = self.defaultFontRegular,
            command = self.cmbLanguage_SelectionChanged)

        yPos -= shiftY

        self.lblResolution = DirectLabel(
            text = _("Screen resolution"),
            scale = 0.15,
            pos = (base.a2dLeft + 0.25, 0, yPos),
            frameColor = (0,0,0,0),
            text_fg = (1,1,1,1),
            #text_font = self.defaultFont,
            text_align = TextNode.ALeft)

        # get the display resolutions
        di = base.pipe.getDisplayInformation()
        sizes = []
        for index in range(di.getTotalDisplayModes()):
            tmptext = "{0}x{1}".format(
                di.getDisplayModeWidth(index),
                di.getDisplayModeHeight(index))
            if not tmptext in sizes:
                sizes.append(tmptext)
#.........这里部分代码省略.........
开发者ID:grimfang,项目名称:rising_reloaded,代码行数:103,代码来源:MenuOptions.py


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