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


Python QtGui.QWidget类代码示例

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


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

示例1: __init__

    def __init__(self, parent):
        QWidget.__init__(self, parent)
        font = QFont(get_family(MONOSPACE), 10, QFont.Normal)

        info_icon = QLabel()
        icon = get_std_icon("MessageBoxInformation").pixmap(24, 24)
        info_icon.setPixmap(icon)
        info_icon.setFixedWidth(32)
        info_icon.setAlignment(Qt.AlignTop)

        self.service_status_label = QLabel()
        self.service_status_label.setWordWrap(True)
        self.service_status_label.setAlignment(Qt.AlignTop)
        self.service_status_label.setFont(font)

        self.desc_label = QLabel()
        self.desc_label.setWordWrap(True)
        self.desc_label.setAlignment(Qt.AlignTop)
        self.desc_label.setFont(font)

        self.group_desc = QGroupBox("Description", self)
        layout = QHBoxLayout()
        layout.addWidget(info_icon)
        layout.addWidget(self.desc_label)
        layout.addStretch()
        layout.addWidget(self.service_status_label)

        self.group_desc.setLayout(layout)

        self.editor = CodeEditor(self)
        self.editor.setup_editor(linenumbers=True, font=font)
        self.editor.setReadOnly(False)
        self.group_code = QGroupBox("Source code", self)
        layout = QVBoxLayout()
        layout.addWidget(self.editor)
        self.group_code.setLayout(layout)

        self.enable_button = QPushButton(get_icon("apply.png"), "Enable", self)

        self.save_button = QPushButton(get_icon("filesave.png"), "Save", self)

        self.disable_button = QPushButton(get_icon("delete.png"), "Disable", self)

        self.refresh_button = QPushButton(get_icon("restart.png"), "Refresh", self)
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.save_button)
        hlayout.addWidget(self.enable_button)
        hlayout.addWidget(self.disable_button)
        hlayout.addWidget(self.refresh_button)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.group_desc)
        vlayout.addWidget(self.group_code)
        self.html_window = HTMLWindow()
        vlayout.addWidget(self.html_window)

        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)

        self.current_file = None
开发者ID:hutchic,项目名称:dd-agent,代码行数:60,代码来源:gui.py

示例2: __init__

    def __init__(self):
        QWidget.__init__(self)

        self.setWindowTitle( 'Biofeedback' )

        self.button_start = QPushButton()
        self.button_start.setText("START")
        self.button_stop = QPushButton()
        self.button_stop.setText("STOP")

        layout = QHBoxLayout(self)
        layout.addWidget(self.button_start)
        layout.addWidget(self.button_stop)

        self.connect(self.button_start, SIGNAL("clicked(bool)"), self.start_session)
        self.connect(self.button_stop, SIGNAL("clicked(bool)"), self.stop_session)

        self.setLayout(layout)
        self.setGeometry(300,100,250,100)
        self.show()

        #self.datastorage = DataStorage()
        #settings = {'db_host':'amber','db_user':'root','db_pwd':'dbrootpass','db_dbname':'biodb'}
        #self.datastorage.enableDbStorage(settings)


        self.thread = ConnectionThread()
开发者ID:darkopetrovic,项目名称:ZephyrApp,代码行数:27,代码来源:zephyr_test_nogui.py

示例3: __init__

 def __init__(self, parent, x, y, func):
     QWidget.__init__(self, parent)
     self.setMinimumSize(320, 200)
     self.x = x
     self.y = y
     self.func = func
     #---guiqwt curve item attribute:
     self.curve_item = None
开发者ID:HaMF,项目名称:guiqwt,代码行数:8,代码来源:filtertest1.py

示例4: __init__

 def __init__(self, manager, parent=None):
     QSplitter.__init__(self, Qt.Horizontal, parent)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.manager = manager
     self.plots = []
     self.itemlist = None
     main = QWidget()
     self.plotlayout = QGridLayout()
     main.setLayout(self.plotlayout)
     self.addWidget(main)
开发者ID:HaMF,项目名称:guiqwt,代码行数:10,代码来源:plot.py

示例5: __init__

 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowTitle("Signal filtering 2 (guiqwt)")
     self.setWindowIcon(get_icon('guiqwt.svg'))
     
     hlayout = QHBoxLayout()
     central_widget = QWidget(self)
     central_widget.setLayout(hlayout)
     self.setCentralWidget(central_widget)
     #---guiqwt plot manager
     self.manager = PlotManager(self)
开发者ID:CaptainAL,项目名称:Spyder,代码行数:11,代码来源:filtertest2.py

示例6: __init__

 def __init__(self, manager, parent=None, **kwargs):
     super(SubplotWidget, self).__init__(parent, **kwargs)
     self.setOrientation(Qt.Horizontal)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.manager = manager
     self.plots = []
     self.itemlist = None
     main = QWidget()
     self.plotlayout = QGridLayout()
     main.setLayout(self.plotlayout)
     self.addWidget(main)
开发者ID:alimuldal,项目名称:guiqwt,代码行数:11,代码来源:plot.py

示例7: get_std_icon

def get_std_icon(name, size=None):
    """
    Get standard platform icon
    Call 'show_std_icons()' for details
    """
    if not name.startswith('SP_'):
        name = 'SP_'+name
    icon = QWidget().style().standardIcon( getattr(QStyle, name) )
    if size is None:
        return icon
    else:
        return QIcon( icon.pixmap(size, size) )
开发者ID:Alwnikrotikz,项目名称:guidata,代码行数:12,代码来源:qthelpers.py

示例8: __init__

    def __init__(self, parent, options=None):
        QWidget.__init__(self, parent=parent)

        if options is None:
            options = {}
        self.imagewidget = ImageWidget(self, **options)
        self.imagewidget.register_all_image_tools()

        hlayout = QHBoxLayout()
        self.add_buttons_to_layout(hlayout)
        
        vlayout = QVBoxLayout()
        vlayout.addWidget(self.imagewidget)
        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)
开发者ID:alimuldal,项目名称:guiqwt,代码行数:15,代码来源:base.py

示例9: __init__

    def __init__(self, parent):
        QWidget.__init__(self, parent)

        layout = QGridLayout()
        self.setLayout(layout)

        self.plot1 = ImagePlot(self)
        layout.addWidget(self.plot1, 0, 0, 1, 1)
        self.plot2 = ImagePlot(self)
        layout.addWidget(self.plot2, 1, 0, 1, 1)

        self.contrast = ContrastAdjustment(self)
        layout.addWidget(self.contrast, 2, 0, 1, 2)
        self.itemlist = PlotItemList(self)
        layout.addWidget(self.itemlist, 0, 1, 2, 1)

        self.manager = PlotManager(self)
        for plot in (self.plot1, self.plot2):
            self.manager.add_plot(plot)
        for panel in (self.itemlist, self.contrast):
            self.manager.add_panel(panel)
开发者ID:gyenney,项目名称:Tools,代码行数:21,代码来源:manager.py

示例10: __init__

 def __init__(self, parent):
     QWidget.__init__(self, parent)
     font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
     
     info_icon = QLabel()
     icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
     info_icon.setPixmap(icon)
     info_icon.setFixedWidth(32)
     info_icon.setAlignment(Qt.AlignTop)
     self.desc_label = QLabel()
     self.desc_label.setWordWrap(True)
     self.desc_label.setAlignment(Qt.AlignTop)
     self.desc_label.setFont(font)
     group_desc = QGroupBox(_("Description"), self)
     layout = QHBoxLayout()
     layout.addWidget(info_icon)
     layout.addWidget(self.desc_label)
     group_desc.setLayout(layout)
     
     self.editor = CodeEditor(self)
     self.editor.setup_editor(linenumbers=True, font=font)
     self.editor.setReadOnly(True)
     group_code = QGroupBox(_("Source code"), self)
     layout = QVBoxLayout()
     layout.addWidget(self.editor)
     group_code.setLayout(layout)
     
     self.run_button = QPushButton(get_icon("apply.png"),
                                   _("Run this script"), self)
     self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
     hlayout = QHBoxLayout()
     hlayout.addWidget(self.run_button)
     hlayout.addStretch()
     hlayout.addWidget(self.quit_button)
     
     vlayout = QVBoxLayout()
     vlayout.addWidget(group_desc)
     vlayout.addWidget(group_code)
     vlayout.addLayout(hlayout)
     self.setLayout(vlayout)
开发者ID:stonebig,项目名称:guidata,代码行数:40,代码来源:guitest.py

示例11: __init__

 def __init__(self, parent):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     row_nb = 14
     cindex = 0
     for child in dir(QStyle):
         if child.startswith('SP_'):
             if cindex == 0:
                 col_layout = QVBoxLayout()
             icon_layout = QHBoxLayout()
             icon = get_std_icon(child)
             label = QLabel()
             label.setPixmap(icon.pixmap(32, 32))
             icon_layout.addWidget( label )
             icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) )
             col_layout.addLayout(icon_layout)
             cindex = (cindex+1) % row_nb
             if cindex == 0:
                 layout.addLayout(col_layout)                    
     self.setLayout(layout)
     self.setWindowTitle('Standard Platform Icons')
     self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
开发者ID:Alwnikrotikz,项目名称:guidata,代码行数:22,代码来源:qthelpers.py

示例12: setup_instance

    def setup_instance(self, instance):
        """Override DataSetEditDialog method"""
        from guidata.dataset.datatypes import DataSetGroup
        assert isinstance(instance, DataSetGroup)
        tabs = QTabWidget()
#        tabs.setUsesScrollButtons(False)
        self.layout.addWidget(tabs)
        for dataset in instance.datasets:
            layout = QVBoxLayout()
            layout.setAlignment(Qt.AlignTop)
            if dataset.get_comment():
                label = QLabel(dataset.get_comment())
                label.setWordWrap(self.wordwrap)
                layout.addWidget(label)
            grid = QGridLayout()
            self.edit_layout.append( self.layout_factory(dataset, grid) )
            layout.addLayout(grid)
            page = QWidget()
            page.setLayout(layout)
            if dataset.get_icon():
                tabs.addTab( page, get_icon(dataset.get_icon()),
                             dataset.get_title() )
            else:
                tabs.addTab( page, dataset.get_title() )
开发者ID:Alwnikrotikz,项目名称:guidata,代码行数:24,代码来源:qtwidgets.py

示例13: __init__

    def __init__( self, parent ):
        QThread.__init__(self, parent)
        self.currsecond = 0
        self.asc = True
        self.initseconds = 0
        self.stopped = True

        self.toolbar_time = parent.addToolBar( 'Time' )
        self.toolbar_time.setMovable( False )
        self.toolbar_time.setObjectName('Time')
        self.timer = QLineEdit()
        self.timer.setStyleSheet("QLineEdit { font-size: 19px; font-family: Courier New; \
                                border-style: outset; border-radius: 10px; \
                                font-weight:bold; text-align:center}")
        self.timer.setFixedWidth( 80 )
        self.timer.setReadOnly( True )
        self.timer.setAlignment( Qt.AlignHCenter )

        left_spacer = QWidget()
        left_spacer.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding )
        self.toolbar_time.addWidget( left_spacer )
        self.toolbar_time.addWidget( self.timer )

        self.initialize(0)
开发者ID:darkopetrovic,项目名称:ZephyrApp,代码行数:24,代码来源:gui.py

示例14: __init__

    def __init__(self, parent):
        QWidget.__init__(self, parent)
        font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
        
        info_icon = QLabel()
        icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
        info_icon.setPixmap(icon)
        info_icon.setFixedWidth(32)
        info_icon.setAlignment(Qt.AlignTop)

        self.service_status_label = QLabel()
        self.service_status_label.setWordWrap(True)
        self.service_status_label.setAlignment(Qt.AlignTop)
        self.service_status_label.setFont(font)

        self.desc_label = QLabel()
        self.desc_label.setWordWrap(True)
        self.desc_label.setAlignment(Qt.AlignTop)
        self.desc_label.setFont(font)

        group_desc = QGroupBox("Description", self)
        layout = QHBoxLayout()
        layout.addWidget(info_icon)
        layout.addWidget(self.desc_label)
        layout.addStretch()
        layout.addWidget(self.service_status_label  )

        group_desc.setLayout(layout)
        
        self.editor = CodeEditor(self)
        self.editor.setup_editor(linenumbers=True, font=font)
        self.editor.setReadOnly(False)
        group_code = QGroupBox("Source code", self)
        layout = QVBoxLayout()
        layout.addWidget(self.editor)
        group_code.setLayout(layout)
        
        self.enable_button = QPushButton(get_icon("apply.png"),
                                      "Enable", self)

        self.save_button = QPushButton(get_icon("filesave.png"),
                                      "Save", self)

        self.edit_datadog_conf_button = QPushButton(get_icon("edit.png"),
                                      "Edit agent settings", self)

        self.disable_button = QPushButton(get_icon("delete.png"),
                                      "Disable", self)


        self.view_log_button = QPushButton(get_icon("txt.png"), 
                                      "View log", self)

        self.menu_button = QPushButton(get_icon("settings.png"),
                                      "Manager", self)



        hlayout = QHBoxLayout()
        hlayout.addWidget(self.save_button)
        hlayout.addStretch()
        hlayout.addWidget(self.enable_button)
        hlayout.addStretch()
        hlayout.addWidget(self.disable_button)
        hlayout.addStretch()
        hlayout.addWidget(self.edit_datadog_conf_button)
        hlayout.addStretch()
        hlayout.addWidget(self.view_log_button)
        hlayout.addStretch()
        hlayout.addWidget(self.menu_button)
        
        vlayout = QVBoxLayout()
        vlayout.addWidget(group_desc)
        vlayout.addWidget(group_code)
        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)

        self.current_file = None
开发者ID:arthurnn,项目名称:dd-agent,代码行数:78,代码来源:gui.py

示例15: __init__

 def __init__(self, parent):
     if PYQT5:
         super(DockableWidget, self).__init__(parent, parent=parent)
     else:
         QWidget.__init__(self, parent)
         DockableWidgetMixin.__init__(self, parent)
开发者ID:CaptainAL,项目名称:Spyder,代码行数:6,代码来源:qtwidgets.py


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