zoukankan      html  css  js  c++  java
  • pyqt5学习之QRadioButton

    QRadioButton继承于QAbstractButton;一般用于给用户提供若干选项中的单选操作
    案例
    from PyQt5.Qt import *
    import sys
    
    app = QApplication(sys.argv)
    
    window = QWidget()
    window.setWindowTitle('QRadioButton-功能测试')
    window.resize(500, 500)
    
    red = QWidget(window)
    red.resize(200,200)
    red.setStyleSheet('background-colour: red;')
    red.move(50, 50)
    
    green = QWidget(window)
    green.resize(200, 200)
    green.setStyleSheet("background-color: green;")
    green.move(red.x() + red.width(), red.y() + red.height())
    
    rb_nan = QRadioButton('', red) #设置QRadioButton方法
    rb_nan.setShortcut('alt+a')  # 设置快捷键
    rb_nan.move(10, 10)
    rb_nan.setChecked(True)
    
    rb_nv = QRadioButton("女-&Female", red)
    rb_nv.move(10, 50)
    rb_nv.setIcon(QIcon("dp.png"))
    rb_nv.setIconSize(QSize(60, 60))
    rb_nv.toggled.connect(lambda isChecked: print(isChecked))  #常用信号
    
    rb_yes = QRadioButton("yes", green)
    rb_yes.move(10, 10)
    rb_no = QRadioButton("no", green)
    rb_no.move(10, 50)
    
    
    
    window.show()
    
    sys.exit(app.exec_())
    View Code

     

  • 相关阅读:
    CSPS模拟 65
    CSPS模拟 64
    $color$有色图
    CSPS模拟 63
    CSPS模拟 62
    CSPS模拟 61
    CSPS模拟 60
    CSPS模拟 59
    go中单链表
    MYSQL-联合索引
  • 原文地址:https://www.cnblogs.com/mosewumo/p/12515186.html
Copyright © 2011-2022 走看看