在嘗試使用Dash創(chuàng)建一個(gè)儀表板時(shí)(使用PyQt5創(chuàng)建一個(gè)GUI),我遇到了一個(gè)問(wèn)題。我嘗試將以下示例代碼作為模塊以及在代碼末尾:import dashimport dash_core_components as dccimport dash_html_components as htmldef 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=True)但是每次我得到錯(cuò)誤 can't find '__main__' module in ''我知道,起初,要使用以下方式創(chuàng)建Dash的主要后衛(wèi):if __name__ == '__main__':app.run_server(debug=True)但是我已經(jīng)為MainWindow設(shè)置了一個(gè)主后衛(wèi),所以我不知道如何使兩者一起工作。供參考,這是我的MainWindow主警衛(wèi):if __name__ == '__main__':app = QApplication(sys.argv)mainWin = MainWindow()mainWin.show()sys.exit(app.exec_())
添加回答
舉報(bào)
0/150
提交
取消