PySimpleGUI / PySimpleGUI

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.
https://www.PySimpleGUI.com
Other
13.4k stars 1.84k forks source link

[Question] - Is it possible to add real-time Matplotlib graph using PySimpleGUI? #6668

Closed NazikAtajanova closed 8 months ago

NazikAtajanova commented 8 months ago

Type of Issue (Enhancement, Error, Bug, Question)

Question

Operating System

Windows

PySimpleGUI Port (tkinter, Qt, Wx, Web)


Versions

Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

Python version (sg.sys.version)

PySimpleGUI Version (sg.__version__)

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)


Your Experience In Months or Years (optional) 2 month

Years Python programming experience 6 month

Years Programming experience overall

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) No

Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

Detailed Description

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:


# Paste your code here

Screenshot, Sketch, or Drawing


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.

PySimpleGUI commented 8 months ago

Look through the Demo Programs for Matplotlib demos. I'm not sure what you mean by "real-time Matplotlib graph". Maybe you can add more info after looking at what we've got posted in the materials.

There are also examples located in the eCookbook (Trinket),

https://pysimplegui.trinket.io/demo-programs#/matplotlib/matplotlib-single-plot

Maybe the animated one is what you meant?

https://pysimplegui.trinket.io/demo-programs#/matplotlib/animated-matplotlib-line-graph

NazikAtajanova commented 8 months ago

By real-time graph I meant a graph where you directly display values from sensors changing on time (maybe to say dynamic graph would be more good for explaining)

jason990420 commented 8 months ago

Please provide detail description, and a full, executable and short script, also steps and figures to demo your question.

NazikAtajanova commented 8 months ago

Unfortunately, I don't have any codes, I have just specification on what I need to do. Real-time graph is something shown in this video: https://www.youtube.com/watch?v=s7qMxpDUS3c

PySimpleGUI commented 8 months ago

I would recommend using a Graph Element for something like you're describing.

I use them, for example, to show a realtime graph of my CPU's cores. It's always running and constantly updating.

You'll have no problem making an application that reads and graphically displays data in realtime. There are a lot of examples for you to see to get started.

image

PySimpleGUI commented 8 months ago

The eCookbook has a lot of examples for the Graph element

Animated Line Graph is like what you're describing.

https://pysimplegui.trinket.io/demo-programs#/graph-element/animated-line-graph

I think you'll find a ton of examples and explanations for this kind of program.

NazikAtajanova commented 8 months ago

Thank you for your support!

PySimpleGUI commented 8 months ago

SURE! We're here to help. Thank you for the "thank you" image It honestly means a lot to me to know we're doing a good job and are making a difference when helping.