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


Python QWidget.setLayout方法代码示例

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


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

示例1: set_board_widget

# 需要导入模块: from qt import QWidget [as 别名]
# 或者: from qt.QWidget import setLayout [as 别名]
    def set_board_widget(self, board_widget):
        self.board_widget = board_widget

        layout = QHBoxLayout()
        layout.addWidget(board_widget, 2)
        layout.addWidget(self.create_sidebar_widget())
        central_widget = QWidget(self)
        central_widget.setLayout(layout)
        self.setCentralWidget(central_widget)

        self.repaint()
开发者ID:oleglite,项目名称:checkers,代码行数:13,代码来源:window.py

示例2: setupInputFrame

# 需要导入模块: from qt import QWidget [as 别名]
# 或者: from qt.QWidget import setLayout [as 别名]
 def setupInputFrame(self, parent=None):
   if not parent:
     parent = self.layout
   self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
   self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
   self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
   self.bgMultiVolumeSelector.addEnabled = 0
   self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
   inputFrameWidget = QWidget()
   self.inputFrameLayout = QFormLayout()
   inputFrameWidget.setLayout(self.inputFrameLayout)
   self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel, self.bgMultiVolumeSelector)
   parent.addWidget(inputFrameWidget)
开发者ID:naucoin,项目名称:MultiVolumeExplorer,代码行数:15,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py

示例3: create_sidebar_widget

# 需要导入模块: from qt import QWidget [as 别名]
# 或者: from qt.QWidget import setLayout [as 别名]
    def create_sidebar_widget(self):
        self.lcd_widget = QLCDNumber(self)
        self.lcd_widget.setFixedHeight(100)
        self.set_score(0, 0)
        self.log_widget = QPlainTextEdit(self)

        sidebar = QWidget(self)
        sidebar_layout = QVBoxLayout()
        sidebar_layout.addWidget(self.lcd_widget)
        sidebar_layout.addWidget(self.log_widget)
        sidebar.setLayout(sidebar_layout)

        sidebar.setFixedWidth(250)


        return sidebar
开发者ID:oleglite,项目名称:checkers,代码行数:18,代码来源:window.py

示例4: __init__

# 需要导入模块: from qt import QWidget [as 别名]
# 或者: from qt.QWidget import setLayout [as 别名]
 def __init__(self, kongs, deferred):
     KDialogIgnoringEscape.__init__(self)
     decorateWindow(self)
     self.setButtons(0)
     self.kongs = kongs
     self.selectedKong = None
     self.deferred = deferred
     layout = QVBoxLayout()
     label = QLabel(m18n('Which kong do you want to declare?'))
     layout.addWidget(label)
     layout.setAlignment(label, Qt.AlignHCenter)
     self.buttons = []
     for kong in kongs:
         button = QRadioButton((kong[0].name()), self)
         self.buttons.append(button)
         layout.addWidget(button)
         button.toggled.connect(self.toggled)
     widget = QWidget(self)
     widget.setLayout(layout)
     self.setMainWidget(widget)
开发者ID:KDE,项目名称:kajongg,代码行数:22,代码来源:humanclient.py

示例5: __init__

# 需要导入模块: from qt import QWidget [as 别名]
# 或者: from qt.QWidget import setLayout [as 别名]
class qSlicerMultiVolumeExplorerSimplifiedModuleWidget:

  def __init__(self, parent=None):
    logging.debug("qSlicerMultiVolumeExplorerSimplifiedModuleWidget:init() called")
    if not parent or not hasattr(parent, "layout"):
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(QVBoxLayout())
    else:
      self.parent = parent

    self.layout = self.parent.layout()

    self._bgMultiVolumeNode = None
    self._fgMultiVolumeNode = None

    self.styleObserverTags = []
    self.sliceWidgetsPerStyle = {}

    self.chartPopupWindow = None
    self.chartPopupSize = QSize(600, 300)
    self.chartPopupPosition = QPoint(0,0)

  def hide(self):
    self.widget.hide()

  def show(self):
    self.widget.show()

  def setup(self):
    self.widget = QWidget()
    layout = QGridLayout()
    self.widget.setLayout(layout)
    self.layout.addWidget(self.widget)
    self.widget.show()
    self.layout = layout

    self.setupInputFrame()
    self.setupFrameControlFrame()
    self.setupAdditionalFrames()
    self.setupPlottingFrame()

    self.setFramesEnabled(False)

    self.timer = QTimer()
    self.timer.setInterval(50)

    self.setupConnections()

    # initialize slice observers (from DataProbe.py)
    # keep list of pairs: [observee,tag] so they can be removed easily
    self.styleObserverTags = []
    # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic
    self.sliceWidgetsPerStyle = {}
    self.refreshObservers()

  def setupInputFrame(self, parent=None):
    if not parent:
      parent = self.layout
    self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
    self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
    self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
    self.bgMultiVolumeSelector.addEnabled = 0
    self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
    inputFrameWidget = QWidget()
    self.inputFrameLayout = QFormLayout()
    inputFrameWidget.setLayout(self.inputFrameLayout)
    self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel, self.bgMultiVolumeSelector)
    parent.addWidget(inputFrameWidget)

  def setupFrameControlFrame(self):
    # TODO: initialize the slider based on the contents of the labels array
    self.frameSlider = ctk.ctkSliderWidget()
    self.frameLabel = QLabel('Current frame number')
    self.playButton = QPushButton('Play')
    self.playButton.toolTip = 'Iterate over multivolume frames'
    self.playButton.checkable = True
    frameControlHBox = QHBoxLayout()
    frameControlHBox.addWidget(self.frameLabel)
    frameControlHBox.addWidget(self.frameSlider)
    frameControlHBox.addWidget(self.playButton)
    self.inputFrameLayout.addRow(frameControlHBox)

  def setupAdditionalFrames(self):
    pass

  def setupPlottingFrame(self, parent=None):
    if not parent:
      parent = self.layout
    self.plottingFrameWidget = QWidget()
    self.plottingFrameLayout = QGridLayout()
    self.plottingFrameWidget.setLayout(self.plottingFrameLayout)
    self._multiVolumeIntensityChart = MultiVolumeIntensityChartView()
    self.popupChartButton = QPushButton("Undock chart")
    self.popupChartButton.setCheckable(True)
    self.plottingFrameLayout.addWidget(self._multiVolumeIntensityChart.chartView)
    self.plottingFrameLayout.addWidget(self.popupChartButton)
    parent.addWidget(self.plottingFrameWidget)

  def setupConnections(self):
    self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged)
#.........这里部分代码省略.........
开发者ID:naucoin,项目名称:MultiVolumeExplorer,代码行数:103,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py


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