PyQt: “AttributeError: 'Form' object has no attribute 'exec_'” when opening second window
# -*- coding: utf-8 -*- import sys
from PyQt5.QtWidgets import QApplication , QMainWindow
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from Ui_splashView import *
from LoginMain import LoginMain class SplashMain(QMainWindow, Ui_Form):
def __init__(self, parent=None):
super(SplashMain, self).__init__(parent)
self.setWindowFlags(Qt.SplashScreen|Qt.FramelessWindowHint)
self.setupUi(self) self.time=5
self.timer=QTimer(self)
self.timer.timeout.connect(self.countTime)
self.timer.start(1000) def countTime(self):
self.time-=1
self.label_2.setText("还有"+str(self.time)+"秒跳转登入界面")
if(self.time==0):
self.close()
self.myWin2 = LoginMain()
self.myWin2.show() if __name__=="__main__":
app = QApplication(sys.argv)
myWin = SplashMain()
myWin.show()
sys.exit(app.exec_())
以上代码是 splash窗口负责欢迎提示的,然后关闭自身窗口打开一个新的窗口。
以上红色部分的代码是修正以后的,之前的代码为:
myWin2 = LoginMain()
myWin2.show()
myWin2.exec_()
如果这么写的话就会报错,如下:
PyQt: “AttributeError: 'Form' object has no attribute 'exec_'” when opening second window
在 网址:
https://blog.csdn.net/qq_32856147/article/details/79646163
找到了一些解答。

照此修正,不再报错。
PyQt: “AttributeError: 'Form' object has no attribute 'exec_'” when opening second window的更多相关文章
- PyQt程序执行时报错:AttributeError: 'winTest' object has no attribute 'setCentralWidget'的解决方法
用QtDesigner设计了一个UI界面,保存在文件Ui_wintest.ui中,界面中使用了MainWindow窗口,窗口名字也叫MainWindow,用PyUIC将其转换成了 Ui_wintest ...
- 关于flask登录视图报错AttributeError: '_AppCtxGlobals' object has no attribute 'user'
在一个小程序中写了一个登录视图函数,代码如下: @app.route('/login',methods = ['GET','POST']) @oid.loginhandler def login(): ...
- AttributeError: 'WebElement' object has no attribute 'send_keys'
这个是没问题的代码:用来打开谷歌搜索cheese并退出 from selenium import webdriver from selenium.common.exceptions import Ti ...
- 解决AttributeError: 'Ui_MainWindow' object has no attribute 'show'报错
1.首先使用pyqt designer来设计ui界面,将其保存为"***.ui"文件, 然后进入到pyqt所在的文件目录中,执行cmd中命令,即在当前目录中可以生成相应的**.py ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- AttributeError: 'list' object has no attribute 'write_pdf'
我在可视化决策树,运行以下代码时报错:AttributeError: 'list' object has no attribute 'write_pdf' 我使用的是python3.4 from sk ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
- AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'
/*************************************************************************** * AttributeError: 'modu ...
- AttributeError: 'dict_values' object has no attribute 'translate'
/***************************************************************************************** * Attribu ...
随机推荐
- Vmware 设置桥接模式
在搭建VMware虚拟机的时候要配置网络 可以看到一共主要就3种 1.桥接模式(Bridge) 虚拟系统的IP可设置成与本机系统在同一网段,虚拟系统相当于网络内的一台.独立的机器,与本机共同插在一个H ...
- 关于Bonobo Git Server的安装
1.关于安装 参考官网:https://bonobogitserver.com/ 实际上就是在IIS上搭建一个MVC程序.安装教程:https://bonobogitserver.com/instal ...
- ThreadPoolExecutor源码浅析
目录 初始化 ctl变量 添加任务 addWorker方法 worker实现 执行任务 关闭连接池 参考 初始化 ThreadPoolExecutor重载了多个构造方法,不过最终都是调用的同一个: p ...
- 搭建Nginx图片服务器(Linux)
知识点: 在Linux系统上安装Nginx服务器,配置图片访问路径 通过ftp上传图片到,指定路径,通过浏览器访问指定路径中的图片 参考博客:http://blog.csdn.net/maoyuanm ...
- webservice用cxf发布SOAP
cxf的安装,就是把文件解压,然后配置环境变量 http://cxf.apache.org/download.html这是官网下载 解压到这里 环境变量 wsdl2java命令测试 1.新建java项 ...
- Examining the Rooms - 第一类斯特灵数
---恢复内容开始--- 2017-08-10 20:32:37 writer:pprp 题意如下: Recently in Teddy's hometown there is a competiti ...
- SPSS 分布类型的检验
假设检验的标准步骤: 1.建立假设:根据问题的需要提出原假设H0,以及其对立面备择假设H1. 2.确立检验水准:即设立小概率事件的界值α. 3.进行试验:得到用于统计分析的样本,以该试验的结果作为假设 ...
- poj 2528 Mayor's posters 线段树+离散化 || hihocode #1079 离散化
Mayor's posters Description The citizens of Bytetown, AB, could not stand that the candidates in the ...
- vim与shell切换
扩展一些vim的知识. vim与shell切换 :shell 可以在不关闭vi的情况下切换到shell命令行. :exit 从shell回到vim. 文件浏览 :Ex 开启目录浏览器,可以浏览当前目录 ...
- javascript 关键词 new都做了写什么
翻译自stackoverflow:http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript ne ...