• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qt.QWidget类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self):

        QWidget.__init__(self)

        self.textBrowser = QTextBrowser(self)
        self.textBrowser.setTextFormat(QTextBrowser.LogText)
        self.lineEdit = QLineEdit(self)
        self.startButton = QPushButton(self.tr("Start"), self)
        self.stopButton = QPushButton(self.tr("Stop"), self)
        self.stopButton.setEnabled(False)

        self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.startCommand)
        self.connect(self.startButton, SIGNAL("clicked()"), self.startCommand)
        self.connect(self.stopButton, SIGNAL("clicked()"), self.stopCommand)
        layout = QGridLayout(self, 2, 3)
        layout.setSpacing(8)
        layout.addMultiCellWidget(self.textBrowser, 0, 0, 0, 2)
        layout.addWidget(self.lineEdit, 1, 0)
        layout.addWidget(self.startButton, 1, 1)
        layout.addWidget(self.stopButton, 1, 2)



        self.process = QProcess()
        self.connect(self.process, SIGNAL("readyReadStdout()"), self.readOutput)
        self.connect(self.process, SIGNAL("readyReadStderr()"), self.readErrors)
        self.connect(self.process, SIGNAL("processExited()"), self.resetButtons)
开发者ID:emayssat,项目名称:sandbox,代码行数:27,代码来源:qt3_qproc.py


示例2: closeEvent

 def closeEvent( self, event ):
     """Redefinicion del closeEvent de qt"""
     QWidget.closeEvent( self, event )
     if not self.parent.vprincipal.isVisible():
         qApp.exit(0)
     else:
         self.hide()
开发者ID:,项目名称:,代码行数:7,代码来源:


示例3: __init__

 def __init__(self, parent, umlmachines, name="InstallerWidget"):
     QWidget.__init__(self, parent, name)
     self.resize(600, 600)
     self.app = get_application_pointer()
     self.conn = self.app.conn
     self.umlmachines = umlmachines
     self.machine = self.umlmachines.current
     self.current_machine_process = "start"
     self.current_profile = None
     self.current_trait = None
     self.traitlist = []
     self.curenv = CurrentEnvironment(self.conn, self.machine)
     self.curenv["current_profile"] = "None"
     self.curenv["current_trait"] = "None"
     self.curenv["current_machine_process"] = self.current_machine_process
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
     self.timer.startTimer(1000)
     self.grid = QGridLayout(self, 4, 1, 5, 7)
     self.main_label = QLabel(self)
     self.main_label.setText(self._msg())
     self.grid.addWidget(self.main_label, 0, 0)
     self.profile_progress_lbl = QLabel(self)
     self.grid.addWidget(self.profile_progress_lbl, 1, 0)
     self.profile_progress = KProgress(self)
     self.grid.addWidget(self.profile_progress, 2, 0)
     self.logview = LogBrowser(self, "/tmp/uml-installer.log")
     self.grid.addWidget(self.logview, 3, 0)
     # self.console_view = StdOutBrowser(self)
     # self.console_view = KTextBrowser(self)
     # self.grid.addWidget(self.console_view, 4, 0)
     self.console_text = ""
开发者ID:joelsefus,项目名称:paella,代码行数:32,代码来源:installer.py


示例4: __init__

    def __init__(self, interfazdato, cajadisponible):
        """Caja disponible son los elementos que aparecen a la izquierda en el selector"""
        #VARIABLES PUBLICAS
        QWidget.__init__(self, None, "selector", 0)

        image1 = QPixmap(IMAGE1DATA)
        image2 = QPixmap(IMAGE2DATA)

        selectorsimplelayout = QHBoxLayout(self, 11, 6, "WSelectorSimpleLayout")
        layout2 = QVBoxLayout(None, 0, 6, "layout2")
        widgetstack1 = QWidgetStack(self, "staaack")
        widgetstack1.addWidget(cajadisponible)
        widgetstack1.raiseWidget(cajadisponible)
        widgetstack1.setSizePolicy(QSizePolicy(\
                QSizePolicy.Expanding, QSizePolicy.Expanding, \
                0, 0, widgetstack1.sizePolicy().hasHeightForWidth()))
        self._cajadisponible = cajadisponible
        layout2.addWidget(widgetstack1)
        selectorsimplelayout.addLayout(layout2)
        
        layout1 = QVBoxLayout(None, 0, 6, "layout1")
        
        self.__pushbutton1 = QPushButton(self, "pushButton1")
        self.__pushbutton1.setMaximumSize(QSize(30, 30))
        self.__pushbutton1.setPixmap(image1)
        layout1.addWidget(self.__pushbutton1)
        spacer1 = QSpacerItem(30, 122, QSizePolicy.Minimum, QSizePolicy.Expanding)
        layout1.addItem(spacer1)
        
        self.__pushbutton2 = QPushButton(self,"pushButton2")
        self.__pushbutton2.setMaximumSize(QSize(30, 30))
        self.__pushbutton2.setPixmap(image2)
        self.__pushbutton2.setAccel("Del")
        layout1.addWidget(self.__pushbutton2)
        selectorsimplelayout.addLayout(layout1)
        
        layout3 = QVBoxLayout(None, 0, 6, "layout3")
        
        self._textlabel2 = QLabel(self, "textLabel2")
        layout3.addWidget(self._textlabel2)
        
        self._cajaseleccion = QListBox(self,"cajaseleccion")
        self._cajaseleccion.setMinimumSize(QSize(0, 60))
        layout3.addWidget(self._cajaseleccion)
        selectorsimplelayout.addLayout(layout3)
        self._cajaseleccion.setSizePolicy(QSizePolicy(\
                QSizePolicy.Expanding,QSizePolicy.Expanding, 0, 0, \
                self._cajaseleccion.sizePolicy().hasHeightForWidth()))
        
        self.setCaption("Form1")
        self._textlabel2.setText(u"Selección")
        
        self.resize(QSize(294, 240).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)
        self.__conexiones()
        #Miembros !qt

        self.seleccion = []
        self._dato = interfazdato
开发者ID:,项目名称:,代码行数:59,代码来源:


示例5: __init__

 def __init__(self, parent, name='TestConfigTab'):
     QWidget.__init__(self, parent, name)
     self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
     self.textbrowser = KTextBrowser(self)
     self.grid.addWidget(self.textbrowser, 0, 0)
     self.button = KPushButton(self)
     self.button.setText('test get_config')
     self.grid.addWidget(self.button, 1, 0)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:8,代码来源:cfgmain.py


示例6: __init__

 def __init__(self, parent, text='', name='LabeledProgress'):
     QWidget.__init__(self, parent, name)
     self.grid = QGridLayout(self, 2, 1, 5, 7)
     self.label = QLabel(self)
     if text:
         self.label.setText(text)
     self.progressbar = SimpleProgress(self)
     self.grid.addWidget(self.label, 0, 0)
     self.grid.addWidget(self.progressbar, 1, 0)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:9,代码来源:progress.py


示例7: set_board_widget

    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,代码行数:11,代码来源:window.py


示例8: __init__

 def __init__(self, parent, name="SoundBlasterHardwareOptions"):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 1
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols, margin, space, "SoundBlasterHardwareOptionsLayout")
     self._default_oplmodes = ["auto", "cms", "opl2", "dualopl2", "opl3"]
     self.oplmode_box = ConfigComboBoxWidget(self, "OPL mode", self._default_oplmodes)
     self.grid.addWidget(self.oplmode_box, 0, 0)
     self.oplrate_box = SampleRateOption(self, "OPL sample rate")
     self.grid.addWidget(self.oplrate_box, 1, 0)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:12,代码来源:sndcfg.py


示例9: __init__

 def __init__(self, parent, fields=[], data={}, name='VariablesEditor'):
     QWidget.__init__(self, parent, name)
     self.initPaellaCommon()
     self.grid = QGridLayout(self, len(fields), 2, 1, -1, 'VariablesEditorLayout')
     self.fields = fields
     self.fields.sort()
     self._data = data
     self.entries = {}
     self._labels = {}
     if fields:
         self._setup_grid()
     self.grid.setSpacing(7)
     self.grid.setMargin(10)
开发者ID:joelsefus,项目名称:paella,代码行数:13,代码来源:recordedit.py


示例10: setupInputFrame

 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,代码行数:13,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py


示例11: __init__

 def __init__(self, app, parent, dtype='trait', name='BaseDiffer'):
     QWidget.__init__(self, parent, name)
     dbwidget(self, app)
     self.dtype = dtype
     if dtype == 'trait':
         boxtype = SuiteTraitCombo
     elif dtype == 'family':
         boxtype = FamilyList
     self.leftBox = boxtype(self.app, self, 'leftBox')
     self.rightBox = boxtype(self.app, self, 'rightBox')
     self.vbox = QVBoxLayout(self)
     self.list_hbox = QHBoxLayout(self.vbox, 5)
     self.list_hbox.addWidget(self.leftBox)
     self.list_hbox.addWidget(self.rightBox)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:14,代码来源:differ.py


示例12: setup

  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()
开发者ID:naucoin,项目名称:MultiVolumeExplorer,代码行数:26,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py


示例13: create_sidebar_widget

    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,代码行数:16,代码来源:window.py


示例14: sizeHint

 def sizeHint(self):
     """we never want a horizontal scrollbar for player names,
     we always want to see them in full"""
     result = QWidget.sizeHint(self)
     available = KApplication.kApplication().desktop().availableGeometry()
     height = max(result.height(), available.height() * 2 // 3)
     width = max(result.width(), available.width() // 2)
     return QSize(width, height)
开发者ID:KDE,项目名称:kajongg,代码行数:8,代码来源:rulesetselector.py


示例15: __init__

 def __init__(self, parent, umlmachines, name='RunnerWidget'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.umlmachines = umlmachines
     self.proc = self.umlmachines.run_machine()
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
     self.timer.startTimer(1000)
开发者ID:joelsefus,项目名称:paella,代码行数:17,代码来源:runner.py


示例16: __init__

 def __init__(self, parent, suite, name="RunnerWidget"):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     cfg = self.app.umlcfg
     basefile = make_base_filesystem(suite, "%s.base" % suite, cfg=cfg, size=300, mkfs="mke2fs")
     self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg)
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText("Bootstrapping suite %s" % suite)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
     self.timer.startTimer(1000)
开发者ID:joelsefus,项目名称:paella,代码行数:18,代码来源:bootstrapper.py


示例17: __init__

 def __init__(self, parent, name='WinSizeEntryWidget'):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 2
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols,
                             margin, space, 'WinSizeEntryWidgetLayout')
     self.w_label = QLabel('width', self)
     self.grid.addWidget(self.w_label, 0, 0)
     # should be using KIntSpinBox instead of text entry
     self.w_entry = KLineEdit(self)
     self.grid.addWidget(self.w_entry, 1, 0)
     self.h_label = QLabel('height', self)
     self.grid.addWidget(self.h_label, 0, 1)
     # should be using KIntSpinBox instead of text entry
     self.h_entry = KLineEdit(self)
     self.grid.addWidget(self.h_entry, 1, 1)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:18,代码来源:config.py


示例18: __init__

 def __init__(self, app, parent, name='SuiteTraitCombo'):
     QWidget.__init__(self, parent, name)
     dbwidget(self, app)
     self.suiteCursor = Suites(self.conn)
     self.suites = self.suiteCursor.list()
     self.traits = Traits(self.conn, self.suites[0])
     self.scombo = SuiteCombo(self, self.suites)
     self.tcombo = MyCombo(self, 'TypeCombo')
     self.tcombo.fill(['template', 'script'])
     self.ubutton = KPushButton('update', self)
     self.listView = TraitList(self.app, self)
     self.vbox = QVBoxLayout(self)
     for member in ['listView', 'scombo', 'tcombo', 'ubutton']:
         widget = getattr(self, member)
         self.vbox.addWidget(widget)
     self.connect(self.scombo,
                  SIGNAL('highlighted(int)'), self.update_traits)
     self.connect(self.ubutton,
                  SIGNAL('clicked()'), self.refreshlistView)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:19,代码来源:differ.py


示例19: __init__

 def __init__(self, scene):
     QWidget.__init__(self)
     self.scene = scene
     decorateWindow(self, m18n("Scoring for this Hand"))
     self.nameLabels = [None] * 4
     self.spValues = [None] * 4
     self.windLabels = [None] * 4
     self.wonBoxes = [None] * 4
     self.detailsLayout = [None] * 4
     self.details = [None] * 4
     self.__tilePixMaps = []
     self.__meldPixMaps = []
     grid = QGridLayout(self)
     pGrid = QGridLayout()
     grid.addLayout(pGrid, 0, 0, 2, 1)
     pGrid.addWidget(QLabel(m18nc("kajongg", "Player")), 0, 0)
     pGrid.addWidget(QLabel(m18nc("kajongg", "Wind")), 0, 1)
     pGrid.addWidget(QLabel(m18nc("kajongg", "Score")), 0, 2)
     pGrid.addWidget(QLabel(m18n("Winner")), 0, 3)
     self.detailTabs = QTabWidget()
     self.detailTabs.setDocumentMode(True)
     pGrid.addWidget(self.detailTabs, 0, 4, 8, 1)
     for idx in range(4):
         self.setupUiForPlayer(pGrid, idx)
     self.draw = QCheckBox(m18nc("kajongg", "Draw"))
     self.draw.clicked.connect(self.wonChanged)
     btnPenalties = QPushButton(m18n("&Penalties"))
     btnPenalties.clicked.connect(self.penalty)
     self.btnSave = QPushButton(m18n("&Save Hand"))
     self.btnSave.clicked.connect(self.game.nextScoringHand)
     self.btnSave.setEnabled(False)
     self.setupUILastTileMeld(pGrid)
     pGrid.setRowStretch(87, 10)
     pGrid.addWidget(self.draw, 7, 3)
     self.cbLastTile.currentIndexChanged.connect(self.slotLastTile)
     self.cbLastMeld.currentIndexChanged.connect(self.slotInputChanged)
     btnBox = QHBoxLayout()
     btnBox.addWidget(btnPenalties)
     btnBox.addWidget(self.btnSave)
     pGrid.addLayout(btnBox, 8, 4)
     StateSaver(self)
     self.refresh()
开发者ID:KDE,项目名称:kajongg,代码行数:42,代码来源:scoringdialog.py


示例20: __init__

 def __init__(self, parent, action, name='MultiGameProgress'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.fhandler = self.app.make_new_fileshandler()
     self.action = action
     self.game_progressBar = KProgress(self)
     self.file_progressBar = KProgress(self)
     self.file_progressBarLbl = QLabel(self)
     self.game_progressBarLbl = QLabel(self)
     self.grid = QGridLayout(self, 4, 1, 5, 7)
     self.grid.addWidget(self.file_progressBarLbl, 0, 0)
     self.grid.addWidget(self.file_progressBar, 1, 0)
     self.grid.addWidget(self.game_progressBarLbl, 2, 0)
     self.grid.addWidget(self.game_progressBar, 3, 0)
     if action == 'prepare_game':
         self.game_action = 'Prepare'
         self.fhandler._report_extract_from_installed_archive = self.report_file_extracted
     else:
         self.game_action = 'Clean up'
         self.fhandler.archivehelper.report_installed_file_handled = self.report_file_handled
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:20,代码来源:progress_dialogs.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python qt4reactor.install函数代码示例发布时间:2022-05-26
下一篇:
Python qt.QTimer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap