當前位置: 首頁>>代碼示例>>Python>>正文


Python QtWidgets.QGridLayout方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QGridLayout方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QGridLayout方法的具體用法?Python QtWidgets.QGridLayout怎麽用?Python QtWidgets.QGridLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QGridLayout方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def __init__(self, setting_params=None):
        super().__init__()
        self.setting_params = setting_params
        self.search_input = Qw.QLineEdit()
        self.table = AngryTableView(self.setting_params['angrysearch_lite'],
                                    self.setting_params['row_height'])
        self.upd_button = Qw.QPushButton('update')
        self.fts_checkbox = Qw.QCheckBox()

        grid = Qw.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.search_input, 1, 1)
        grid.addWidget(self.fts_checkbox, 1, 3)
        grid.addWidget(self.upd_button, 1, 4)
        grid.addWidget(self.table, 2, 1, 4, 4)
        self.setLayout(grid)

        self.setTabOrder(self.search_input, self.table)
        self.setTabOrder(self.table, self.upd_button)


# THE MAIN APPLICATION WINDOW WITH THE STATUS BAR AND LOGIC
# LOADS AND SAVES QSETTINGS FROM ~/.config/angrysearch
# INITIALIZES AND SETS GUI, WAITING FOR USER INPUTS 
開發者ID:DoTheEvo,項目名稱:ANGRYsearch,代碼行數:27,代碼來源:angrysearch.py

示例2: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def __init__(self, parent=None, win=None, xrefs_list=None, method="", path=""):
        super(XrefDialog, self).__init__(parent)

        if not isinstance(xrefs_list, list) or len(xrefs_list) == 0:
            log.warning("Bad XrefDialog creation")
            return

        if not method:
            title = "Xrefs to %s" % path.split("/")[-1]
        else:
            title = "Xrefs to %s -> %s" % (path.split("/")[-1], method)

        self.setWindowTitle(title)
        layout = QtWidgets.QGridLayout()
        xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
        layout.addWidget(xrefwin, 0, 0)
        self.setLayout(layout) 
開發者ID:amimo,項目名稱:dcc,代碼行數:19,代碼來源:xrefwindow.py

示例3: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def __init__(self, title="Calendar"):
        super(CalendarWidget, self).__init__()

        self.setWindowTitle(title)
        layout = qt_widgets.QGridLayout()
        layout.setColumnStretch(1, 1)

        self.cal = qt_widgets.QCalendarWidget(self)
        self.cal.setGridVisible(True)
        self.cal.clicked[QtCore.QDate].connect(self.show_date)
        layout.addWidget(self.cal, 0, 0, 1, 2)

        self.date_label = qt_widgets.QLabel()
        self.date = self.cal.selectedDate()
        self.date_label.setText(self.date.toString())
        layout.addWidget(self.date_label, 1, 0)

        button_box = qt_widgets.QDialogButtonBox()
        confirm_button = button_box.addButton(qt_widgets.QDialogButtonBox.Ok)
        confirm_button.clicked.connect(self.confirm)
        layout.addWidget(button_box, 1, 1)

        self.setLayout(layout)
        self.show()
        self.raise_() 
開發者ID:aroberge,項目名稱:easygui_qt,代碼行數:27,代碼來源:calendar_widget.py

示例4: setupUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def setupUi(self, QHangupsConversations):
        QHangupsConversations.setObjectName("QHangupsConversations")
        QHangupsConversations.resize(500, 350)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversations)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.conversationsTabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.conversationsTabWidget.setElideMode(QtCore.Qt.ElideRight)
        self.conversationsTabWidget.setTabsClosable(True)
        self.conversationsTabWidget.setMovable(True)
        self.conversationsTabWidget.setObjectName("conversationsTabWidget")
        self.gridLayout.addWidget(self.conversationsTabWidget, 0, 0, 1, 1)
        QHangupsConversations.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversations)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversations.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversations)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversations.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversations)
        self.conversationsTabWidget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversations) 
開發者ID:xmikos,項目名稱:qhangups,代碼行數:27,代碼來源:ui_qhangupsconversations.py

示例5: create_grid

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def create_grid(self, grid_width, grid_height):
        """Create a grid layout with stacked widgets.

        Parameters
        ----------
        grid_width : int
            the width of the grid
        grid_height : int
            the height of the grid
        """
        self.grid_layout = QGridLayout()
        self.setLayout(self.grid_layout)
        self.grid_layout.setSpacing(1)
        self.grid_wgs = {}
        for i in xrange(grid_height):
            for j in xrange(grid_width):
                self.grid_wgs[(i, j)] = FieldWidget()
                self.grid_layout.addWidget(self.grid_wgs[(i, j)], i, j) 
開發者ID:duguyue100,項目名稱:minesweeper,代碼行數:20,代碼來源:gui.py

示例6: _initUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _initUi(self, title, label, default):
        self.setWindowTitle(title)
 
        # 控件
        label_ = QLabel(label)
        self._lineEdit = QLineEdit(str(self._data['data']) if self._data else str(default) )

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(label_, 0, 0, 1, 2)
        grid.addWidget(self._lineEdit, 0, 2, 1, 2)

        grid.addWidget(okPushButton, 1, 2, 1, 2)
        grid.addWidget(cancelPushButton, 1, 0, 1, 2)
 
 
        self.setLayout(grid) 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:26,代碼來源:DySingleEditDlg.py

示例7: _initUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _initUi(self):
        self.setWindowTitle('進程數')
 
        # 控件
        processNbrLable = QLabel('進程數')
        self._processNbrLineEdit = QLineEdit(str(self._data['nbr']) if self._data else '0' )

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(processNbrLable, 0, 0)
        grid.addWidget(self._processNbrLineEdit, 1, 0, 1, 2)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
 
        self.setLayout(grid) 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:26,代碼來源:DyProcessNbrDlg.py

示例8: _initUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _initUi(self):
        self.setWindowTitle('個股資料(F10)')
 
        # 控件
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        self._stockInfoWidget = DyTreeWidget(self.fields)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10)
 
        grid.addWidget(okPushButton, 0, 10)
        grid.addWidget(cancelPushButton, 1, 10)
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:24,代碼來源:DyStockInfoDlg.py

示例9: _initUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _initUi(self):
        self.setWindowTitle('日K線前後交易日周期')
 
        # 控件
        dayKChartPeriodLable = QLabel('股票(指數)日K線前後交易日周期')
        self._dayKChartPeriodLineEdit = QLineEdit(str(self._data['periodNbr']) if self._data else '60' )

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(dayKChartPeriodLable, 0, 0, 1, 2)
        grid.addWidget(self._dayKChartPeriodLineEdit, 1, 0, 1, 2)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
 
        self.setLayout(grid) 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:26,代碼來源:DyStockSelectDayKChartPeriodDlg.py

示例10: _createIndicatorGroupBox

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _createIndicatorGroupBox(self):
        indicatorGroupBox = QGroupBox('指標')

        grid = QGridLayout()
        grid.setSpacing(10)

        rowNbr = 4
        self._indicatorCheckBoxList = []
        for i, indicator in enumerate(DyStockDataCommon.dayIndicators):
            checkBox = QCheckBox(indicator)
            checkBox.setChecked(True)

            grid.addWidget(checkBox, i//rowNbr, i%rowNbr)

            self._indicatorCheckBoxList.append(checkBox)

        indicatorGroupBox.setLayout(grid)

        return indicatorGroupBox 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:21,代碼來源:DyStockDataHistDaysManualUpdateDlg.py

示例11: _createConnectionTab

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _createConnectionTab(self, tabWidget):
        widget = QWidget()

        labelHost = QLabel('主機')
        labelPort = QLabel('端口')

        self._lineEditHost = QLineEdit(self._data['Connection']["Host"])
        self._lineEditPort = QLineEdit(str(self._data['Connection']["Port"]))

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(labelHost, 0, 0)
        grid.addWidget(self._lineEditHost, 0, 1)

        grid.addWidget(labelPort, 0, 2)
        grid.addWidget(self._lineEditPort, 0, 3)
 
        widget.setLayout(grid)

        tabWidget.addTab(widget, "連接") 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:24,代碼來源:DyStockMongoDbConfigDlg.py

示例12: _initUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def _initUi(self):
        self.setWindowTitle('配置-賬號(實盤交易)')

        self._tabWidget = QTabWidget()
        self._createYhTab()
        self._createThsTab()
        
        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._tabWidget, 0, 0, 2, 1)

        grid.addWidget(okPushButton, 0, 1)
        grid.addWidget(cancelPushButton, 1, 1)
 
        self.setLayout(grid) 
開發者ID:moyuanz,項目名稱:DevilYuan,代碼行數:24,代碼來源:DyStockAccountConfigDlg.py

示例13: setupUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def setupUi(self, About):
        About.setObjectName("About")
        About.resize(498, 369)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(About.sizePolicy().hasHeightForWidth())
        About.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(About)
        self.verticalLayout.setObjectName("verticalLayout")
        self.gridLayout_11 = QtWidgets.QGridLayout()
        self.gridLayout_11.setObjectName("gridLayout_11")
        self.label_6 = QtWidgets.QLabel(About)
        self.label_6.setObjectName("label_6")
        self.gridLayout_11.addWidget(self.label_6, 1, 1, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_11.addItem(spacerItem, 1, 2, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_11.addItem(spacerItem1, 1, 0, 1, 1)
        spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_11.addItem(spacerItem2, 0, 1, 1, 1)
        spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_11.addItem(spacerItem3, 2, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout_11)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem4)
        self.button_close = QtWidgets.QPushButton(About)
        self.button_close.setObjectName("button_close")
        self.horizontalLayout.addWidget(self.button_close)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(About)
        QtCore.QMetaObject.connectSlotsByName(About) 
開發者ID:mbusb,項目名稱:multibootusb,代碼行數:37,代碼來源:ui_about.py

示例14: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def __init__(self, electrode_struct):
        super(Ui_Electrode, self).__init__()

        self.electrode_struct = copy.deepcopy(electrode_struct)
        mainLayout = QtWidgets.QGridLayout()

        self.glElectrode = GLElectrode()
        self.set_shape_size_layout()
        self.set_connector_layout()
        self.set_type_tick_layout()
        self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.checkAndAccept)
        #self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        mainLayout.addWidget(self.shape_size, 0,4)
        mainLayout.addWidget(self.type_thick, 1,4)
        mainLayout.addWidget(self.connector_box,2,4)
        mainLayout.addWidget(self.glElectrode,0,0,4,4)
        mainLayout.addWidget(self.button_box, 4,4)


        self.update_electrode()
        self.glElectrode.electrode_object, self.glElectrode.plug_object = self.glElectrode.drawElectrode(self.electrode_struct)
        self.glElectrode.electrode_struct = self.electrode_struct
        self.glElectrode.update()

        self.setLayout(mainLayout)
        self.resize(900,450)

        self.setWindowTitle('Electrode')


    #Shape and size box 
開發者ID:simnibs,項目名稱:simnibs,代碼行數:36,代碼來源:electrodeGUI.py

示例15: selectFileLayout

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QGridLayout [as 別名]
def selectFileLayout(self):

        self.select_file = QtWidgets.QGroupBox('')
        layout = QtWidgets.QGridLayout()

        tag_m2m = QtWidgets.QLabel('<b>m2m Folder:<\\b>')
        layout.addWidget(tag_m2m, 1, 0, 1, 3)

        self.m2m_folder_lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.m2m_folder_lineEdit, 2, 0, 1, 3)
 
        file_browse_m2m = QtWidgets.QPushButton('Browse')
        file_browse_m2m.clicked.connect(self.m2mFolderDialog)
        layout.addWidget(file_browse_m2m,2,3,1,1)

        tag = QtWidgets.QLabel('<b>Head Mesh:<\\b>')
        layout.addWidget(tag,3,0,1,3)

        self.file_name = QtWidgets.QLineEdit()
        layout.addWidget(self.file_name, 4, 0, 1, 3)
 
        file_browse = QtWidgets.QPushButton('Browse')
        file_browse.clicked.connect(self.fileDialog)
        layout.addWidget(file_browse, 4, 3, 1, 1)

        tag_Out = QtWidgets.QLabel('<b>Output Folder:<\\b>')
        layout.addWidget(tag_Out,5,0,1,3)

        self.out_folder_lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.out_folder_lineEdit,6,0,1,3)
 
        file_browse_out = QtWidgets.QPushButton('Browse')
        file_browse_out.clicked.connect(self.outFolderDialog)
        layout.addWidget(file_browse_out,6,3,1,1)



        self.select_file.setLayout(layout) 
開發者ID:simnibs,項目名稱:simnibs,代碼行數:40,代碼來源:main_gui.py


注:本文中的PyQt5.QtWidgets.QGridLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。