久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='SkXL5'></small><noframes id='SkXL5'>

    • <bdo id='SkXL5'></bdo><ul id='SkXL5'></ul>
    1. <tfoot id='SkXL5'></tfoot><legend id='SkXL5'><style id='SkXL5'><dir id='SkXL5'><q id='SkXL5'></q></dir></style></legend>

    2. <i id='SkXL5'><tr id='SkXL5'><dt id='SkXL5'><q id='SkXL5'><span id='SkXL5'><b id='SkXL5'><form id='SkXL5'><ins id='SkXL5'></ins><ul id='SkXL5'></ul><sub id='SkXL5'></sub></form><legend id='SkXL5'></legend><bdo id='SkXL5'><pre id='SkXL5'><center id='SkXL5'></center></pre></bdo></b><th id='SkXL5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SkXL5'><tfoot id='SkXL5'></tfoot><dl id='SkXL5'><fieldset id='SkXL5'></fieldset></dl></div>

        在 html 中為 PyQt5 網絡引擎使用本地文件

        Using a local file in html for a PyQt5 webengine(在 html 中為 PyQt5 網絡引擎使用本地文件)
        <legend id='gkxK0'><style id='gkxK0'><dir id='gkxK0'><q id='gkxK0'></q></dir></style></legend>
          <tbody id='gkxK0'></tbody>

        <small id='gkxK0'></small><noframes id='gkxK0'>

          <bdo id='gkxK0'></bdo><ul id='gkxK0'></ul>
          <tfoot id='gkxK0'></tfoot>

                1. <i id='gkxK0'><tr id='gkxK0'><dt id='gkxK0'><q id='gkxK0'><span id='gkxK0'><b id='gkxK0'><form id='gkxK0'><ins id='gkxK0'></ins><ul id='gkxK0'></ul><sub id='gkxK0'></sub></form><legend id='gkxK0'></legend><bdo id='gkxK0'><pre id='gkxK0'><center id='gkxK0'></center></pre></bdo></b><th id='gkxK0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gkxK0'><tfoot id='gkxK0'></tfoot><dl id='gkxK0'><fieldset id='gkxK0'></fieldset></dl></div>

                  本文介紹了在 html 中為 PyQt5 網絡引擎使用本地文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試將繪圖圖嵌入到 PyQt5 網絡引擎視圖中.我可以使用以下方法做到這一點:

                  I am trying to embed a plotly graph into a PyQt5 webengine view. I was able to do so using the following:

                  open plotly in qwebview in interactive mode

                  If you read it, the article explains that you can't directly include the javascript in the HTML when using the webengine view (it has issues loading files above 2 MB). However, I'm trying to make it so that the source for the javascript is a local copy of plotly-min.js (saved in the project folder) so that anyone using the program doesn't need an internet connection to view the graphs it generates. I've tried to follow a few examples on html, but to no avail.

                  The original code that does work with an internet connection is:

                  raw_html = '<html><head><meta charset="utf-8" />'
                  raw_html += '<script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head>'
                  raw_html += '<body>'
                  raw_html += plot(fig, include_plotlyjs=False, output_type='div')
                  raw_html += '</body></html>'
                  
                  temp_view = QWebEngineView()
                  temp_view.setHtml(graph)
                  

                  If I understand it correctly, I need to change this part:

                  <script src="https://cdn.plot.ly/plotly-latest.min.js">
                  

                  I've already tried:

                  <script type="text/javascript" src="file:///C:/Users/UserName/PycharmProjects/ProjectFolder/plotly-latest.min.js"></script>
                  

                  I honestly do not know HTML. This is the only HTML in the code (the rest is in Python 3). Does anyone know why the above might not work and what I need to change? I have a suspicion I might somehow be running into the 2 MB limit the above question referenced, as different variations I've found online for how to reference a local file in HTML don't seem to change anything.

                  解決方案

                  Many browsers for security reason disable the loading of local files, but as noted in the following forum you can enable that capability with:

                  sys.argv.append("--disable-web-security")
                  

                  Assuming the .js is next to your .py file:

                  .
                  ├── main.py
                  └── plotly-latest.min.js
                  

                  you can use the following example:

                  import sys
                  from PyQt5.QtWidgets import QApplication
                  from PyQt5.QtWebEngineWidgets import QWebEngineView
                  from PyQt5.QtCore import QDir, QUrl
                  
                  import plotly
                  import plotly.graph_objs as go
                  
                  sys.argv.append("--disable-web-security")
                  app = QApplication(sys.argv)
                  
                  x1 = [10, 3, 4, 5, 20, 4, 3]
                  trace1 = go.Box(x = x1)
                  layout = go.Layout(showlegend = True)
                  data = [trace1]
                  
                  fig = go.Figure(data=data, layout = layout)
                  
                  path = QDir.current().filePath('plotly-latest.min.js') 
                  local = QUrl.fromLocalFile(path).toString()
                  
                  raw_html = '<html><head><meta charset="utf-8" />'
                  raw_html += '<script src="{}"></script></head>'.format(local)
                  raw_html += '<body>'
                  raw_html += plotly.offline.plot(fig, include_plotlyjs=False, output_type='div')
                  raw_html += '</body></html>'
                  
                  view = QWebEngineView()
                  view.setHtml(raw_html)
                  view.show()
                  
                  sys.exit(app.exec_())
                  

                  這篇關于在 html 中為 PyQt5 網絡引擎使用本地文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                  <legend id='CBhdv'><style id='CBhdv'><dir id='CBhdv'><q id='CBhdv'></q></dir></style></legend>

                  • <i id='CBhdv'><tr id='CBhdv'><dt id='CBhdv'><q id='CBhdv'><span id='CBhdv'><b id='CBhdv'><form id='CBhdv'><ins id='CBhdv'></ins><ul id='CBhdv'></ul><sub id='CBhdv'></sub></form><legend id='CBhdv'></legend><bdo id='CBhdv'><pre id='CBhdv'><center id='CBhdv'></center></pre></bdo></b><th id='CBhdv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CBhdv'><tfoot id='CBhdv'></tfoot><dl id='CBhdv'><fieldset id='CBhdv'></fieldset></dl></div>

                      • <bdo id='CBhdv'></bdo><ul id='CBhdv'></ul>
                          <tbody id='CBhdv'></tbody>
                          <tfoot id='CBhdv'></tfoot>

                          <small id='CBhdv'></small><noframes id='CBhdv'>

                            主站蜘蛛池模板: 成人免费视频网站在线观看 | 亚洲精品乱码久久久久久按摩观 | 91热爆在线观看 | 欧美日韩精品久久久免费观看 | 久久成人av电影 | 精品二区| japan21xxxxhd美女 日本欧美国产在线 | 九九亚洲精品 | 九九九视频在线观看 | 亚洲欧美另类在线 | 伊人超碰| 国产高清区 | 欧美成人免费在线视频 | 中文字幕日韩欧美一区二区三区 | 国产免费人成xvideos视频 | 亚洲成人精品一区二区 | 最新日韩在线 | 岛国一区 | 欧美久久天堂 | av在线一区二区三区 | 国产成人av在线播放 | 亚洲一区二区免费视频 | 久久躁日日躁aaaaxxxx | 亚洲69p| 久草视频在线播放 | 久久久久久久久久一区二区 | 亚洲码欧美码一区二区三区 | 欧美成人精品 | 久久久久久免费毛片精品 | 日韩一级不卡 | 国产特级毛片aaaaaa喷潮 | 精国产品一区二区三区四季综 | 日本三级做a全过程在线观看 | 亚洲精品免费在线观看 | 99re免费 | 中文字幕在线播放第一页 | 欧美激情综合色综合啪啪五月 | 精品99久久 | 欧美一区二区在线播放 | 国产一区二区三区精品久久久 | 日韩欧美综合在线视频 |