Plotly Chart at Tkinter Python

后端 未结 2 1291
离开以前
离开以前 2021-02-19 22:13

is it possible to show Plotly chart at Tkinter GUI? I have been trying to make this happens but to no avail.

Here is the code I have (the Plotly code is copied from the

相关标签:
2条回答
  • 2021-02-19 22:43

    Since

    • plotly can be viewed in your browser, and
    • this answer says you can embed a 'full-blown chromium browser' in Tkinter,

    I imagine it's possible to present an interactive plotly graph in an embedded browser in Tktinter.

    If I get a working example I'll post it here.

    0 讨论(0)
  • 2021-02-19 22:54

    According to: https://plotly.com/python/renderers/ The available plotly renderers are:

     ['plotly_mimetype', 'jupyterlab', 'nteract', 'vscode',
     'notebook', 'notebook_connected', 'kaggle', 'azure', 'colab',
     'cocalc', 'databricks', 'json', 'png', 'jpeg', 'jpg', 'svg',
     'pdf', 'browser', 'firefox', 'chrome', 'chromium', 'iframe',
     'iframe_connected', 'sphinx_gallery']
    

    This means that it is not possible to have tkinter directly handle plotly user interactive events. The closest to what you want would hence be to generate a non interactive plotly rendering eg a png/jpg and display it in a tkinter canvas. At least canvas would allow to pan/scan and zoom. Another alternative would be to open a web browser from the tkinter app but this means user will not directly interact with the original tkinter application.

    0 讨论(0)
提交回复
热议问题