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


Python QPushButton._clicked方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4.Qt import QPushButton [as 别名]
# 或者: from PyQt4.Qt.QPushButton import _clicked [as 别名]
 def __init__(self, parent, config_name=None, buttons=[], *args):
     """Creates dialog.
     'config_name' is used to get/set default window size from Config object
     'buttons' can be a list of names or (QPixmapWrapper,name[,tooltip]) tuples to provide
     custom buttons at the bottom of the dialog. When a button is clicked, the dialog
     emits SIGNAL("name").
     A "Close" button is always provided, this simply hides the dialog.
     """
     QDialog.__init__(self, parent, *args)
     self.setModal(False)
     lo = QVBoxLayout(self)
     # create viewer
     self.label = QLabel(self)
     self.label.setMargin(5)
     self.label.setWordWrap(True)
     lo.addWidget(self.label)
     self.label.hide()
     self.viewer = QTextBrowser(self)
     lo.addWidget(self.viewer)
     # self.viewer.setReadOnly(True)
     self.viewer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     QObject.connect(self.viewer, SIGNAL("anchorClicked(const QUrl &)"), self._urlClicked)
     self._source = None
     lo.addSpacing(5)
     # create button bar
     btnfr = QFrame(self)
     btnfr.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
     # btnfr.setMargin(5)
     lo.addWidget(btnfr)
     lo.addSpacing(5)
     btnfr_lo = QHBoxLayout(btnfr)
     btnfr_lo.setMargin(5)
     # add user buttons
     self._user_buttons = {}
     for name in buttons:
         if isinstance(name, str):
             btn = QPushButton(name, btnfr)
         elif isinstance(name, (list, tuple)):
             if len(name) < 3:
                 pixmap, name = name
                 tip = None
             else:
                 pixmap, name, tip = name
             btn = QPushButton(pixmap.icon(), name, btnfr)
             if tip:
                 btn.setToolTip(tip)
         self._user_buttons[name] = btn
         btn._clicked = Kittens.utils.curry(self.emit, SIGNAL(name))
         self.connect(btn, SIGNAL("clicked()"), btn._clicked)
         btnfr_lo.addWidget(btn, 1)
     # add a Close button
     btnfr_lo.addStretch(100)
     closebtn = QPushButton(pixmaps.grey_round_cross.icon(), "Close", btnfr)
     self.connect(closebtn, SIGNAL("clicked()"), self.hide)
     btnfr_lo.addWidget(closebtn, 1)
     # resize selves
     self.config_name = config_name or "html-viewer"
     width = Config.getint('%s-width' % self.config_name, 512)
     height = Config.getint('%s-height' % self.config_name, 512)
     self.resize(QSize(width, height))
开发者ID:kernsuite-debian,项目名称:purr,代码行数:62,代码来源:MainWindow.py


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