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


Python QCheckBox.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import __init__ [as 别名]
  def __init__(self, 
               parentWidget, 
               text          = '', 
               widgetColumn  = 1,
               state         = None, ##Qt.Unchecked, 
               setAsDefault  = True,
               spanWidth = False
               ):
      """
      Appends a QCheckBox (Qt) widget to the bottom of I{parentWidget}, 
      a Property Manager group box.
      
      @param parentWidget: The parent group box containing this widget.
      @type  parentWidget: PM_GroupBox
      
      @param text: This property holds the text shown on the checkbox.                     
      @type  text: str
      
      @param widgetColumn: The column number of the PM_CheckBox widget
                           in the group box grid layout. The only valid values 
                           are 0 (left column) and 1 (right column). 
                           The default is 1 (right column).                             
      @type  widgetColumn: int
      
      @param state: Set's the check box's check state. The default is
                    Qt.Unchecked (unchecked).
      @type  state: U{B{Qt.CheckState}<http://doc.trolltech.com/4/
                        qt.html#CheckState-enum>}
      
      @param setAsDefault: If True, will restore I{state} when the 
                           "Restore Defaults" button is clicked.
      @type  setAsDefault: bool
      
      @param spanWidth: if True, the widget and its label will span the width
                    of the group box. Its label will appear directly above
                    the widget (unless the label is empty) and is left 
                    justified.
      @type  spanWidth: bool
   
      
      @see: U{B{QCheckBox}<http://doc.trolltech.com/4/qcheckbox.html>}
      """
                      
      QCheckBox.__init__(self)
      self.parentWidget = parentWidget        
      self.setText(text)
      self.widgetColumn = widgetColumn
      self.setAsDefault = setAsDefault
      self.spanWidth = spanWidth
 
      #Ideally, this should be simply self.setCheckState(state)  with the 
      #default state = Qt.UnChecked in the ,init argument itself. But, 
      #apparently pylint chokes up when init argument is a Qt enum. 
      #This problem happened while running pylint 0.23 on the SEMBOT server 
      #so comitting this temporary workaround. The pylint on my machine is 
      #0.25 and it runs fine even before this workaround. Similar changes made
      #in PM_Slider. 
      #-- Ninad 2008-06-30
      if state is None:
          state = Qt.Unchecked
      
      if self.setAsDefault:
          self.setDefaultState(state)
          
      self.setCheckState(state)          
      
      parentWidget.addPmWidget(self)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:69,代码来源:PM_CheckBox.py

示例2: __init__

# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import __init__ [as 别名]
 def __init__(self, data, key, text, parent):
     QCheckBox.__init__(self, text, parent)
     self.data, self.key = data, key
     self.setChecked(data.get(key, False))
     self.stateChanged.connect(self._changed)
开发者ID:pgarst,项目名称:calibre,代码行数:7,代码来源:themes.py


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