本文整理汇总了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)
#.........这里部分代码省略.........