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 ...
随机推荐
- 使用jsonp去访问跨域数据,回调使用数据
var foo = function (data) { console.log("foo", data)} var testJsonP = function () { $.ajax ...
- Python基础笔记系列七:字符串定义和访问
本系列教程供个人学习笔记使用,如果您要浏览可能需要其它编程语言基础(如C语言),why?因为我写得烂啊,只有我自己看得懂!! 字符串定义和访问 1.字符串基础 a.字符串可以用单引号.双引号.三引号( ...
- css 固定宽度,自动换行
max-width: 200px; display: block; word-break: break-all:
- Iterator 和 for...of 循环
Iterator(遍历器)的概念 § ⇧ JavaScript 原有的表示“集合”的数据结构,主要是数组(Array)和对象(Object),ES6 又添加了Map和Set.这样就有了四种数据集合,用 ...
- vue-router的一个小实例
非2.0的 vue2.0还有vue-router2.0的改变还是挺大的 vue-router是Vue.js官方的路由插件,它和vue.js是深度集成的,适合用于构建单页面应用.vue的单页面应用是基于 ...
- transform对定位元素的影响
1.温故知新 absolute:生成绝对定位的元素,相对于除position:static 定位以外的第一个有定位属性的父元素进行定位,若父元素没有定位属性则相对于浏览器窗口的左上角定位,定位的元素不 ...
- 二十六 Python分布式爬虫打造搜索引擎Scrapy精讲—通过downloadmiddleware中间件全局随机更换user-agent浏览器用户代理
downloadmiddleware介绍中间件是一个框架,可以连接到请求/响应处理中.这是一种很轻的.低层次的系统,可以改变Scrapy的请求和回应.也就是在Requests请求和Response响应 ...
- Jdev 本地RUN页面时候,将异常直接显示出来,而不是乱码
本地运行页面时,经常会遇到以下错误 oracle.jbo.JboException: JBO-29000: JBO-29000: JBO-26028: ???? MemberAttributesDis ...
- Ansible 开发调试 之【模块调试】
本地调试 需要安装jinja2 库 yum -y install python-jinja2 使用官方提供的测试脚本调试 git clone git://github.com/ansible/ansi ...
- Reverse a String
题目: 翻转字符串 先把字符串转化成数组,再借助数组的reverse方法翻转数组顺序,最后把数组转化成字符串. 你的结果必须得是一个字符串 这是一些对你有帮助的资源: Global String Ob ...