- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建一个 GUI 来帮助我的团队快速比较信号形式的大量测试数据。我设想高度模块化、交互式的绘图,其格式类似于 Audacity。我正在 PyQt5 中构建 GUI,目前正在尝试决定用于绘图的内容;我原本计划使用 matplotlib,但对于预期用途而言,它会非常笨重。 Plotly 和/或 Dash 似乎更有前途;然而,它们只在浏览器中显示交互式绘图,所以我需要使用某种嵌入在 GUI 中的浏览器显示。因此,QWebEngineView。
我的 GUI 本身将在我开发的 QTabWidget 的选项卡中容纳绘图,而其他选项卡则填充占位符 matplotlib 绘图,我想替换它们,因为它们缺乏简单的交互性。我能够在浏览器中成功显示网页 (google.com)。
在 PyQt5 GUI 的 QTabWidget 中成功显示 QWebEngineView 对象中的网页
但是,当我将其指向我的破折号图的地址时(出于开发目的,我在另一个内核中运行的单独程序中创建了该地址),它会给出错误:此站点无法提供安全连接:
折线图未显示
On the GUI's Kernel, the error is "[29477:29512:0716/121826.555372:ERROR:ssl_client_socket_impl.cc(1050)] handshake failed; returned -1, SSL error code 1, net_error -107".
In the kernel running the dash plot, the message is:
127.0.0.1 - - [16/Jul/2019 12:18:26] code 400, message Bad request version ('**À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x00')
127.0.0.1 - - [16/Jul/2019 12:18:26] "µ±ª~ÜÎÌDñB¤¦jËfM½;*÷hå¸GÛ¼i©Tè**À+À/À,À0̨̩ÀÀ/5" HTTPStatus.BAD_REQUEST -
这仅在 QTabsWidget 中。短划线图在单独的独立应用程序中显示良好(下面提供了作为占位符短划线图的工作代码)。
破折号图成功显示在简单的 PyQt5 GUI 中
我用谷歌搜索了这个错误,但没有找到相关的结果。我不明白为什么这对于第一个 url 来说工作得很好,但当我将它指向我的破折号图时却失败了,特别是考虑到我能够在我的精简原型(prototype)代码中查看 QWebEngineView 中的破折号图。
折线图工作代码:
import sys
import threading
from PyQt5 import QtWidgets
import dash
import dash_core_components as dcc
import dash_html_components as html
def run_dash(data, layout):
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': data,
'layout': layout
})
])
app.run_server(debug=False)
class MainWindow(QtWidgets.QMainWindow):
pass
if __name__ == '__main__':
data = [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
layout = {
'title': 'Dash Data Visualization'
}
threading.Thread(target=run_dash, args=(data, layout), daemon=True).start()
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit(app.exec_())
运行此代码后,内核会提供绘图的地址。在我的机器上,它是 http://127.0.0.1:8050 .
原型(prototype) GUI 嵌入代码:
import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
web = QWebEngineView()
#web.load(QUrl("https://www.google.com"))
web.load(QUrl("http://127.0.0.1:8050"))
web.show()
sys.exit(app.exec ())
来 self 实际 PyQt5 GUI 的代码片段:
web = QWebEngineView()
# web.load(QUrl("https://www.google.com")) web.load(QUrl("https://127.0.0.1:8050/"))
web.show()
self.ui.TabsContainer.addTab(web, "QWebEngineView Object")
# TabsContainer is a QTabsWidget
如何解决阻止我在 GUI 中嵌入绘图的错误?
编辑:我认为它可能与 QTabWidget 有关,所以我编写了以下简单的代码来测试这个想法,并且我的短划线图显示良好。但是,尽管以相同的方式构建,但它不会显示在我需要的主多线程 GUI 中。
import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
class CustomMainWindow(QMainWindow): # MainWindow is a subclass of QMainWindow
def __init__(self, *args, **kwargs):
super(CustomMainWindow, self).__init__(*args, **kwargs)
# a = 1
self.setWindowTitle("Window Title")
label = QLabel("Label")
label.setAlignment(Qt.AlignCenter)
#
layout = QVBoxLayout()
# layout.addWidget(Color('red'))
# layout.addWidget(Color('green'))
layout.addWidget(Color('blue'))
TW = QTabWidget()
web1 = QWebEngineView()
web1.load(QUrl("http://www.google.com"))
#web1.load(QUrl("http://127.0.0.1:8050"))
web2 = QWebEngineView()
web2.load(QUrl("http://127.0.0.1:8050"))
TW.addTab(web1, 'web1')
TW.addTab(web2, 'web2')
layout.addWidget(TW)
widget = QWidget()
widget.setLayout(layout)
self.setCentralWidget(widget)
class Color(QWidget):
def __init__(self, color, *args, **kwargs):
super(Color, self).__init__(*args, **kwargs)
self.setAutoFillBackground(True)
palette = self.palette()
palette.setColor(QPalette.Window, QColor(color))
self.setPalette(palette)
app = QApplication(sys.argv)
CMWindow = CustomMainWindow() # Instead of using QMainWindow, we now use our custom window subclassed from QMainWindow
CMWindow.show()
sys.exit(app.exec ())
最佳答案
嗯,答案很简单:
在我发布的工作示例中,我加载了 QUrl("http://127.0.0.1:8050 ")。在不起作用的代码中,我使用了 https://。显然 Dash 图不使用 https。
关于python - 在 PyQt5 GUI 中嵌入 Plotly-Dash 图 : Handshake Failed, SSL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57063046/
我正在从不同来源获取新闻提要并添加到数据库,但我遇到异常 Error: Cannot enqueue Handshake after already enqueuing a Handshake. at
嘿,大家好,我只是想制作一个简单的表单,将数据发送到 mySQL 数据库。我的问题是提交后我无法再提交另一份。它只允许我提交表单一次,然后在第二次提交后,我收到此错误“错误:在已经排队握手后无法排队握
我正在尝试将 VisualVM 连接到远程 JMX。 IntelliJ 可以轻松连接,但 VisualVM 失败并在日志输出中显示以下内容: Listening for transport dt_so
我每 5 秒查询一个表并向用户显示。我使用的是mysql 8。应用程序是nodejs。 var con = mysql.createConnection({ host: "localhost",
我正在尝试创建两个函数,一个从 SQL 数据库检索对象,另一个将对象保存到同一个 SQL 数据库。我使用 node.js 和 mysql 来执行此操作。我有两个函数,fetchEmployee 和 E
我正在尝试通过运行命令 ./mvnw compile quarkus:dev 来调试基本的 Quarkus 应用程序在 IntelliJ 上(如 Quarkus 文档中所述)并且它似乎运行正常(给我以
我正在开发一个由 IIS 10 托管的 .Net Core (3.1) Web 应用程序。当我尝试在本地主机上使用 SignalR 时,我能够完全正常连接并从后端接收消息,但是在我将其发布到 IIS
我最近从 AWS ELB 切换到 HAProxy。我正在负载均衡器 (HAProxy 1.5dev19) 上终止 SSL。 自切换以来,我不断在 HAProxy 日志中收到一些 SSL 连接错误(占请
我编写了一个系统,可以自动在 Microsoft Azure 上部署 VM,在上面安装 Sql Server,然后针对新安装的服务器执行 .sql 脚本以初始化环境。周五,这一切都按预期进行。今天,我
我尝试使用 Hyperledger 版本 2.0.0 将我的 Golang 后端连接到正在运行的 Hyperledger 网络... 我在运行“docker-compose up”时看到这个 Serv
我在安装我们的内部产品时遇到 SSL 配置问题。安装在jboss-eap-6.1.上,使用java-1.7.0-openjdk-1.7.0.85.x86_64 日志说: 16:28:11,685 DE
我做到了 import requests url = "https://randomuser.me/api/" data = requests.get(url).json() print data 我
我正在运行为 HTTP/2 客户端提供的代码 Jetty https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-
我需要在使用命名管道与其他进程通信的小型 Linux 程序中实现握手类型协议(protocol)。我已经在使用命名管道时搜索了握手类型协议(protocol)的一般实现模式,但我无法打开任何东西...
我安装了 Docker 版本“Docker 版本 19.03.8,构建 afacb8b”,当我尝试使用 docker pull 命令时,如“docker pull mcr.microsoft.com/
我正在使用 python asynchat 来实现网络协议(protocol)。在连接时,我需要发送命令,服务器通过 session 进行应答。 我的主要问题是我需要等待直到收到 session 响应
握手完成后,我在握手时调用 getPeerCertificates() (socket.getHandshakeSession()) 我正在使用 setNeedClientAuth(true)在服务器
我在 logstash-forward 和 logstash 之间有问题,我已经正确安装了 SSL 证书,但是我有这个错误: Failed to tls handshake with 111.111.
本文整理了Java中us.ihmc.robotDataLogger.handshake.YoVariableHandshakeParser类的一些代码示例,展示了YoVariableHandshake
我是 R 语言的新手 并且正在使用 RConnection 在 java 中尝试一个简单的程序,但它给出了这个异常 org.rosuda.REngine.Rserve.RserveException:
我是一名优秀的程序员,十分优秀!