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


Python QtGui.QButtonGroup方法代码示例

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


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

示例1: screenOptions

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def screenOptions(self):
        if QtGui.QDesktopWidget().numScreens() == 1:
            self.screenFull = None
            return None
        groupBox = QtGui.QGroupBox("Screen Area")
        groupBox.setAlignment(QtCore.Qt.AlignHCenter)
        groupBox.setFixedHeight(120)
        self.screenGroup = QtGui.QButtonGroup(groupBox)
        self.displays = []
        for x in range(0, QtGui.QDesktopWidget().numScreens()):
            self.displays.append(QtGui.QRadioButton("Monitor %d" % x))
        self.screenFull = QtGui.QRadioButton("All Monitors")
        for screen in self.displays:
            self.screenGroup.addButton(screen)
        self.screenGroup.addButton(self.screenFull)
        screenLayout = QtGui.QVBoxLayout()
        for screen in self.displays:
            screenLayout.addWidget(screen)
        screenLayout.addWidget(self.screenFull)
        screenLayout.addStretch(1)
        self.screenGroup.buttonClicked.connect(self.screenChange)
        groupBox.setLayout(screenLayout)
        return groupBox 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:25,代码来源:options.py

示例2: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def __init__(self, *args, **kwargs):
		super(Window, self).__init__(*args, **kwargs)
		
		self.resize(300,200)

		self.layout = QtGui.QHBoxLayout(self)

		self.modalButton = QtGui.QRadioButton("Go modal")
		self.asyncModalButton = QtGui.QRadioButton("Go async modal")
		self.nonModalButton = QtGui.QRadioButton("Go non-modal")

		self.layout.addWidget(self.modalButton)
		self.layout.addWidget(self.asyncModalButton)
		self.layout.addWidget(self.nonModalButton)

		self.buttonGroup = QtGui.QButtonGroup()
		self.buttonGroup.setExclusive(True)

		self.buttonGroup.addButton(self.modalButton)
		self.buttonGroup.addButton(self.asyncModalButton)
		self.buttonGroup.addButton(self.nonModalButton)

		# Example of a signal with multiple signatures
		# This one can either return the int id of the button, or the button
		# object itself
		self.buttonGroup.buttonClicked['QAbstractButton*'].connect(self.handle_show_dialog) 
开发者ID:justinfx,项目名称:tutorials,代码行数:28,代码来源:modal_dialogs.py

示例3: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def __init__(self, choices, orientation='horizontal', parent=None):
        """
        The choices are specified as a list of dictionaries containing:

        * 'label': Shown in the UI
        * 'value': The value returned is selected

        :param choices: List of choices. See description.
        :type choices: list
        """
        super(RadioSet, self).__init__(parent)
        self.choices = copy(choices)

        if orientation == 'horizontal':
            layout = QtGui.QHBoxLayout()
        else:
            layout = QtGui.QVBoxLayout()

        group = QtGui.QButtonGroup(self)

        for choice in self.choices:
            choice['radio'] = QtGui.QRadioButton(choice['label'])
            group.addButton(choice['radio'])
            layout.addWidget(choice['radio'], stretch=0)
            choice['radio'].toggled.connect(self.on_toggle)

        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        self.setLayout(layout)

        self.group_toggle_fn = lambda: None 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:33,代码来源:GUIElements.py

示例4: createCheckBox

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def createCheckBox(self):
        """
        - Create the checkboxes for analysis type, under analysis tab
        - checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN
        - Trigger enableBox on clicking
        """
        self.checkbox = QtGui.QGroupBox()
        self.checkbox.setTitle("Select Analysis Type")
        self.checkgrid = QtGui.QGridLayout()

        self.checkgroupbtn = QtGui.QButtonGroup()
        self.checkAC = QtGui.QCheckBox("AC")
        self.checkDC = QtGui.QCheckBox("DC")
        self.checkTRAN = QtGui.QCheckBox("TRANSIENT")

        self.checkgroupbtn.addButton(self.checkAC)
        self.checkgroupbtn.addButton(self.checkDC)
        self.checkgroupbtn.addButton(self.checkTRAN)
        self.checkgroupbtn.setExclusive(True)
        self.checkgroupbtn.buttonClicked.connect(self.enableBox)

        self.checkgrid.addWidget(self.checkAC, 0, 0)
        self.checkgrid.addWidget(self.checkDC, 0, 1)
        self.checkgrid.addWidget(self.checkTRAN, 0, 2)
        self.checkbox.setLayout(self.checkgrid)

        return self.checkbox 
开发者ID:FOSSEE,项目名称:eSim,代码行数:29,代码来源:Analysis.py

示例5: flipOptions

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def flipOptions(self):
        groupBox = QtGui.QGroupBox("Tablet Orientation")
        groupBox.setAlignment(QtCore.Qt.AlignHCenter)
        groupBox.setFixedHeight(120)
        self.tabletFlipGroup = QtGui.QButtonGroup(groupBox)
        self.tabletRight = QtGui.QRadioButton("Right-Handed")
        self.tabletLeft = QtGui.QRadioButton("Left-Handed")
        self.tabletFlipGroup.addButton(self.tabletRight)
        self.tabletFlipGroup.addButton(self.tabletLeft)
        flipLayout = QtGui.QVBoxLayout()
        flipLayout.addWidget(self.tabletRight)
        flipLayout.addWidget(self.tabletLeft)
        flipLayout.addStretch(1)
        getCommand = os.popen("xsetwacom --get \"%s stylus\" Rotate" % self.tabletStylus).readlines()
        # check correct button for orientation
        if getCommand[0] == "none\n":
            self.orient = "xsetwacom --set \"%s stylus\" Rotate none" % self.tabletStylus
            self.orient += "\nxsetwacom --set \"%s eraser\" Rotate none" % self.tabletEraser
            self.tabletRight.setChecked(1)
        elif getCommand[0] == "half\n":
            self.orient = "xsetwacom --set \"%s stylus\" Rotate half" % self.tabletStylus
            self.orient += "\nxsetwacom --set \"%s eraser\" Rotate half" % self.tabletEraser
            self.tabletLeft.setChecked(1)
        self.tabletFlipGroup.buttonClicked.connect(self.tabletFlipChange)
        groupBox.setLayout(flipLayout)
        return groupBox 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:28,代码来源:options.py

示例6: penSettings

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QButtonGroup [as 别名]
def penSettings(self):
        groupBox = QtGui.QGroupBox("Mode")
        groupBox.setAlignment(QtCore.Qt.AlignCenter)
        self.penGroup = QtGui.QButtonGroup(groupBox)
        self.penAbs = QtGui.QRadioButton("Absolute")
        self.penAbs.setToolTip("%s maps 1:1 to mapped input area." % self.sensor.title())
        self.penRel = QtGui.QRadioButton("Relative")
        self.penRel.setToolTip("%s moves relative to when it is detected." % self.sensor.title())

        self.penGroup.addButton(self.penAbs)
        self.penGroup.addButton(self.penRel)
        
        penLayout = QtGui.QHBoxLayout()
        penLayout.addWidget(self.penAbs)
        penLayout.addWidget(self.penRel)
        penLayout.addStretch(1)

        #if self.sensor == 'stylus' or self.sensor == 'eraser':
        getCommand = os.popen("xsetwacom --get \"%s %s\" Mode" % (self.tabletName, self.sensor.lower())).readlines()
        #check stylus mode
        if getCommand[0] == "Absolute\n":
            self.penMode = "xsetwacom --set \"%s %s\" mode Absolute" % (self.tabletName, self.sensor.lower())
            self.penAbs.setChecked(1)
        elif getCommand[0] == "Relative\n":
            self.penMode = "xsetwacom --set \"%s %s\" mode Relative" % (self.tabletName, self.sensor.lower())
            self.penRel.setChecked(1)
        if self.sensor == 'stylus':
            #for buttons
            but1 = os.popen(("xsetwacom --get \"%s %s\" Button 2") % (self.tabletName, self.sensor.lower())).readlines()
            but2 = os.popen(("xsetwacom --get \"%s %s\" Button 3") % (self.tabletName, self.sensor.lower())).readlines()
            if but1[0].find('3') != -1 and but2[0].find('2') != -1:
                self.buttons.setChecked(True)
            #for tip touch check
            tip = os.popen("xsetwacom --get \"%s %s\" TabletPCButton" % (self.tabletName, self.sensor.lower())).readlines()
            if tip[0].find('on') != -1:
                self.tiptouch.setChecked(True)
        else:
            self.tiptouch.hide()

        self.penGroup.buttonClicked.connect(self.penChange)

        groupBox.setLayout(penLayout)

        return groupBox 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:46,代码来源:pressure.py


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