# Python GUI advice

**URL:** <https://mworks.discourse.group/t/python-gui-advice/151>\
**Category:** Support\
**Created:** [January 25, 2021, 7:01pm UTC](https://mworks.discourse.group/t/python-gui-advice/151 "2021-01-25T19:01:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [January 25, 2021, 7:01pm UTC](https://mworks.discourse.group/t/python-gui-advice/151/1 "2021-01-25T19:01:17Z")

</div>

Hi Chris,  
I’m adding some Python plotting to our experiments through the client Python Bridge. What do you think is the best way to make plots these days? My plan was to update the plot at the end of each trial, and use matplotlib and the Qt5 backend to display the figure. Are there better web-based backends, or do you have other best-practice approaches to suggest?  
thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [January 25, 2021, 7:44pm UTC](https://mworks.discourse.group/t/python-gui-advice/151/2 "2021-01-25T19:44:22Z")

</div>

Hi Mark,

I don’t do a lot of plotting, so I’m probably not the best person to ask. However, if you want to see how I currently make plots using the Python Script Bridge, have a look at

> **[GitHub - mworks/mworks-python-bridge-plotting-demo: Demonstration of plotting...](https://github.com/mworks/mworks-python-bridge-plotting-demo)**
>
> Demonstration of plotting with MWClient's Python script bridge - GitHub - mworks/mworks-python-bridge-plotting-demo: Demonstration of plotting with MWClient's Python script bridge

I always use matplotlib’s default Mac backend (“MacOSX”). This allows my [Conduit class](https://github.com/dicarlolab-mworks/python_bridge_plotting_demo/blob/master/conduit.py) to use a combination of `pyplot.show()` and `self._stop_main_loop()` to keep the plot window responsive whenever it’s waiting for events (which is most of the time). The Conduit class is meant to be reusable, so you should be able to just pull out conduit.py and use it with your own plotting code.

If you need more info, please let me know.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [January 26, 2021, 4:17am UTC](https://mworks.discourse.group/t/python-gui-advice/151/3 "2021-01-26T04:17:50Z")

</div>

Thanks, Chris.  
The demo is very helpful.

I did a little testing with the Qt5Agg backend, and it appears to be fast enough for what I need. There, you can hook an update event into the Qt5 main loop.

If you hear of anyone doing bridge plotting with fancier methods, including things like mpld3 (D3 for python) or other browser-frontend plotting, please let me know.

Mark

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 7:13pm UTC](https://mworks.discourse.group/t/python-gui-advice/151/4 "2022-07-19T19:13:24Z")

</div>

Closed on July 19, 2022, 7:13pm UTC


