0

I am trying to create a web application using the python dash framework. When I tried with normal HTML or dcc (dash core components), pywebview is able to load the contents. But If I use dash bootstrap components in my UI, the pywebview displays the empty page. I have attached the sample code to reproduce this issue. I am not sure why dbc (dash bootstrap elements) alone are not loading in the pywebview..

Sample code to produce this issue:


""" Importing dependencies """
from threading import Thread
import webview
from dash import dcc, html
import dash
import dash_bootstrap_components as dbc

app = dash.Dash(name, external_stylesheets=[dbc.themes.BOOTSTRAP])

layout = dbc.Button("Test")

""" Issue : The above button is not visible in the pywebview window; But it is available in the browser """

app.layout = html.Div([layout])

if name == "main":

def run_app():
    app.run_server(debug=False)

t = Thread(target=run_app)
t.daemon = True
t.start()

""" Start the desktop application """
window = webview.create_window("PDMAT", "http://127.0.0.1:8050/")
webview.start(debug=True)

So, Ideally, I would like to load dbc(dash bootstrap components) also in pywebview window. Thanks.

1 Answers1

0

The problem is pywebview is using gui as "edgehtml" and not "edgechromium". With GUI as "edgechrmoium" it worked fine. But the "edgechrmoium" has Microsoft Webview 2 runtime as a dependency. So please make sure you have installed "Microsoft Webview 2 runtime" in admin mode so that it will be registered in PC & python makes use of this PC registry.