最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用Pycharm+PyQt5弹出子窗口程序代码
时间:2021-10-13 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下使用Pycharm+PyQt5弹出子窗口程序代码,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
如下:
class video_record(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.startbtn=QPushButton('begin',self) self.startbtn.setGeometry(40,20,100,20) self.startbtn.clicked.connect(self.time1) self.timeshow=QLineEdit('',self) self.timeshow.setGeometry(200,200,100,20) self.setGeometry(100,100,640,480) self.setWindowTitle('rec') self.show() def time1(self): print('rec start') self.nw=newin() self.nw.show() self.nw.exex_() class newin(QDialog): def __init__(self): super().__init__() self.initUI() def initUI(self): self.lblx=QLabel('hh',self) self.lblx.setGeometry(100,100,100,20) self.lblx.setAutoFillBackground(True) self.pale=QPalette() self.pale.setColor(QPalette.Window,Qt.blue) self.lblx.setPalette(self.pale) self.setGeometry(100,100,300,300) self.setWindowTitle('newin') self.show() if __name__ == '__main__': app=QApplication(sys.argv) ex=video_record() ex.show() sys.exit(app.exec_())
如果测试时发现闪退,可以试着修改一下调用子窗口的程序:
把‘show'去掉:
def time1(self): print('rec start') self.nw=newin() #self.nw.show() self.nw.exex_()
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24