Python Forum
draw chart in wx Frame - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: draw chart in wx Frame (/thread-3958.html)



draw chart in wx Frame - ian - Jul-11-2017

I have the following code as startup. I need to add an image place in the wx frame to draw stock chart on it.
I found many similar codes on Internet such as this link below but they draw chart on a popup window, not in a wx frame. Is there a way to do it? thanks.
https://matplotlib.org/examples/pylab_examples/finance_demo.html

import wx
import wx.grid
 
app = wx.App()
window = wx.Frame(None, -1, title='Test', size=(960, 850), pos = (-5, 0))
background = wx.Panel(window)
background.SetBackgroundColour("Blue")
 
grid = wx.grid.Grid(background, size=(312,150), pos=(0,0))
grid.CreateGrid(6,6)
 
window.Show()
app.MainLoop()



RE: draw chart in wx Frame - Larz60+ - Jul-11-2017

This works fine for me.
I don't see how you could possible get a popup.
I think you're confusing the entire application as a popup
[attachment=202]


RE: draw chart in wx Frame - ian - Jul-12-2017

Sorry, I may not explain clearly. the code is what I have done. What I need is to add the second part beside the grid on the frame. I will draw chart in it. Thanks


RE: draw chart in wx Frame - Larz60+ - Jul-12-2017

My suggestion is download the source here: https://pypi.python.org/packages/b7/1a/62fe7e045d99d7c272ca92a58e7e86c88e236a350f3b5067c4d6f1d7d20a/wxPython-4.0.0a3.tar.gz#md5=75c4efeea1cbf28396f1b57a87b82ba3
once done, and code extracted, change to demo directory.
from command line run:
python demo.py
you should be able to find some good examples with sample code of what you're looking for