本文整理匯總了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)
#.........這裏部分代碼省略.........