I am relatively new in working with GUI, and I am using wxPython for that. I am trying to make an interface showing the results of simulations in 5 plots, which should be dynamically showing the variation of the curves. In addition, I need a dynamic text showing the status of a system during the simulation (e.g. on/off). The simulation should start by pushing a start button. Moreover, I should show an image which is the logo of the project. Furthermore, I will place a static text in the corner of the interface. I tried to google and read tutorials, but it is actually hard to find out what I really need. I really appreciate any help and support.
1 Answers
I am guessing the simulation would be a long running process. So you would want to run that process in a separate thread. Basically you'd have a wx.Button
that calls an event handler that starts up the simulation thread. You could make the button a Toggle button that has text that changes from ON to OFF for that matter.
I am guessing the simulation will need to communicate with your UI to update the plots. You'll probably want to check out the following links for information on using threads with wxPython and what the thread-safe methods are:
- http://wiki.wxpython.org/LongRunningTasks
- http://www.blog.pythonlibrary.org/2010/05/22/wxpython-and-threads/
To display an image, you'll probably want to take a look at wx.StaticBitmap
. There are examples of its usage in the wxPython demo which you can get from the project's website. This tutorial might help you with that as well:
For plotting, wxPython has a simple widget called PyPlot. As usual, the wxPython demo has a good example, but these links will probably help too:
- http://www.blog.pythonlibrary.org/2010/09/27/wxpython-pyplot-graphs-with-python/
- http://www.wxpython.org/docs/api/wx.lib.plot-module.html
If PyPlot doesn't do what you need, then you can switch to FloatCanvas or matplotlib.
Hope that helps.

- 1
- 1

- 32,629
- 8
- 45
- 88
-
Thank you for thorough answer, I will try to follow your suggestions. – Basem Idlbi Jun 06 '15 at 13:04