本文整理汇总了Python中pyjamas.ui.RootPanel.RootPanel.remove方法的典型用法代码示例。如果您正苦于以下问题:Python RootPanel.remove方法的具体用法?Python RootPanel.remove怎么用?Python RootPanel.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.RootPanel.RootPanel
的用法示例。
在下文中一共展示了RootPanel.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onModuleLoad
# 需要导入模块: from pyjamas.ui.RootPanel import RootPanel [as 别名]
# 或者: from pyjamas.ui.RootPanel.RootPanel import remove [as 别名]
class PanelApp:
""" A generic multiple-panel web application.
This class makes it easy to handle multiple panels within a web
application. Panels are shown as they are required.
"""
def onModuleLoad(self):
""" Dynamically build our user interface when the web page is loaded.
"""
self._curPanelID = None # ID of currently-shown panel.
self._root = RootPanel()
self._panels = self.createPanels()
self.showPanel(self.getDefaultPanel())
def showPanel(self, panelID):
""" Show the panel with the given ID.
"""
if panelID == self._curPanelID: return
if self._curPanelID is not None:
self._root.remove(self._panels[self._curPanelID])
self._root.add(self._panels[panelID])
self._curPanelID = panelID
# ==============================
# == METHODS TO BE OVERRIDDEN ==
# ==============================
def createPanels(self):
""" Create the various panels to be used by this application.
This should be overridden by the subclass to create the various
panels the application will use. Upon completion, the subclass
should return a dictionary mapping the ID to use for each panel to
the panel to be displayed.
"""
Window.alert("Must be overridden.")
def getDefaultPanel(self):
""" Return the ID of the panel to show on system startup.
"""
Window.alert("Must be overridden.")