最新下载
热门教程
- 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_()
相关文章
- 成品短视频app下载必备软件-成品短视频app全收录 03-14
- 爱趣漫画官方下载安装最新版本-爱趣漫画官方正版APP安卓入口 03-14
- 快手官方网页版入口-快手网页版免下载直接访问 03-14
- 仙境传说重生公测兑换码大全-2026最新可用兑换码合集 03-14
- 学习通官网登录入口-学习通在线平台直达链接 03-14
- 麻花在线-高清视频入口 03-14