最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用Pycharm+PyQt5弹出子窗口程序代码
时间:2022-06-25 01:40:34 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下使用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_()
相关文章
- 明末渊虚之羽黯淡红羽有什么用 黯淡红羽用途分享 08-04
- win11怎么投影到此电脑 win11系统投影到此电脑的方法 08-04
- 美女请别影响我成仙怎么达成英雄无悔 英雄无悔结局攻略 08-04
- 《QQ》附近小助手通知关闭方法 08-04
- win11鲁大师任务栏标尺如何关闭? 08-04
- 《QQ看点》消息通知设置关闭方法 08-04