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


Python Console.setGeometry方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import setGeometry [as 别名]
class MainWindow(QMainWindow):

    def __init__(self):

        super().__init__()
        self.initUI()

    def initUI(self):
        """
        board:   rightPanel:
        |-------|-------|
        |       |       |
        |       |       |
        |       |       |
        | board | btns  |
        |       |       |
        |       |       |
        |       |       |
        |-------|-------|
        |               |
        | console_outpt |
        |               |
        |---------------|
        | console_input |
        |---------------|
        """

        # widths
        mainWindowWidth = 1000
        rightPanelWidth = 280
        boardWidth = 720

        # heights
        mainWindowHeight = 700
        panelsHeight = 560
        consoleHeight = 140

        # application icon
        base_dir = os.path.dirname(os.path.abspath(__file__))
        iconPath = base_dir[:-4] + r'/images/redCross.png'
        self.setWindowIcon(QIcon(iconPath))

        # window resize and centering
        self.resize(mainWindowWidth, mainWindowHeight)
        self.setMinimumSize(mainWindowWidth, mainWindowHeight)
        self.setMaximumSize(mainWindowWidth, mainWindowHeight)
        self.center()
        self.setWindowTitle('ExperiNurse')

        # ambulatory board
        self.board = Board(self)
        self.board.setGeometry(0, 0, boardWidth, panelsHeight)

        # right panel for buttons and comboBox
        self.rightPanel = RightPanel(self)
        self.rightPanel.setGeometry(boardWidth, 0,
                                    rightPanelWidth, panelsHeight)

        # console
        self.console = Console(self)
        self.console.setGeometry(0, panelsHeight,
                                 mainWindowWidth, consoleHeight)

        self.rightPanel.start.connect(self.board.start)
        self.rightPanel.stop.connect(self.board.stop)
        self.rightPanel.move.connect(self.board.move)
        self.rightPanel.debug.connect(self.board.debug)
        self.rightPanel.inference.connect(self.board.inferenceEmitted)
        self.rightPanel.pathMethod.connect(self.board.pathMethod)
        self.console.textEmitted.connect(self.board.textEmitted)
        self.console.newPatient.connect(self.board.newPatient)
        self.console.goTo.connect(self.board.goTo)
        self.board.emitText.connect(self.console.printText)

        # horizontal layout
        horizontalBox = QHBoxLayout()

        # adding widgets to layout
        horizontalBox.addWidget(self.board)
        horizontalBox.addWidget(self.rightPanel)
        horizontalBox.addWidget(self.console)

        self.show()

    def center(self):
        """
        Centering main window relative to screen geometry
        """

        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2,
                  (screen.height()-size.height())/2)
开发者ID:wieloranski,项目名称:experiNurse,代码行数:95,代码来源:window.py


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