最新下载
热门教程
- 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-03
- 燕云十六声免费外观攻略 最难拿到的三个免费套怎么拿 08-03
- 《弧光突袭者》 Arc Raiders “往昔药方”任务攻略 08-03
- 虚无世界宝宝技能搭配攻略(发掘宝宝技能的无限可能) 08-03
- 颠覆认知 曝PS6双机型定价悬殊 多数玩家恐难承受 08-03
- 《盾勇队长技能更换攻略》(优化战斗力,拓展战术选择,走上巅峰之路) 08-03