FloatCanvas and PlotCanvas, which is better?

I want to make a scrollable canvas in an GUI written by wxPython, and I want
to draw some basic shapes on canvas, which are the elements of flow chart.
Yeah , I'm going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better
and easier to use? I'm a beginer of wxpython. So I need some advice for my
problem.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Hi,

I want to make a scrollable canvas in an GUI written by wxPython, and I want

to draw some basic shapes on canvas, which are the elements of flow chart.

Yeah , I’m going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better

and easier to use? I’m a beginer of wxpython. So I need some advice for my

problem.

Welcome to wxPython! The wxPython toolkit provides its own simple graphing widget called PyPlot, which can be found in wx.lib.plot. The wxPython demo shows how to use it. You can also take a look at this old article on the subject: http://www.blog.pythonlibrary.org/2010/09/27/wxpython-pyplot-graphs-with-python/

If you need to do complex plotting, then matplotlib is probably the way to go as it’s much more advanced. Here are a few links:

http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/
http://wiki.wxpython.org/MatplotlibFourierDemo
http://www.scipy.org/Matplotlib_figure_in_a_wx_panel
http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx

Hope that gets you started!
Mike

···

On Saturday, April 20, 2013 3:55:26 AM UTC-5, Gabrielle wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want
to draw some basic shapes on canvas, which are the elements of flow chart.
Yeah , I'm going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better
and easier to use? I'm a beginer of wxpython. So I need some advice for my
problem.

Welcome!

First, plotCanvas is very old (>7 yrs?) and long-deprecated, as I
understand it. From the Demo:

"PyPlot is an improvement over wxPlotCanvas, which is now deprecated.
If you are using wxPlotCanvas now, please make plans to migrate in
anticipation of the time that wxPlotCanvas disappears completely."

Also, both are for plotting, as in x/y graphs. (Mike, I think you may
have skimmed this post a little too quickly? :D)

So, FloatCanvas would be what you need, I think.

Che

···

On Sat, Apr 20, 2013 at 4:55 AM, Gabrielle <xuan901031@gmail.com> wrote:

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032.html
Sent from the wxPython-users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gabrielle wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want
to draw some basic shapes on canvas, which are the elements of flow chart.
Yeah , I'm going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better
and easier to use? I'm a beginer of wxpython. So I need some advice for my
problem.

I think you are comparing apples and oranges, FloatCanvas and PlotCanvas are not really the same thing. Perhaps you meant FloatCanvas and OGL? Either way, I think I would probably use FloatCanvas for flow charts in new development. OGL has had only slight maintenance for a long while now.

···

--
Robin Dunn
Software Craftsman

OK,thanks! I will have look

···

On Tuesday, April 23, 2013 3:47:51 AM UTC+8, Mike Driscoll wrote:

Hi,

On Saturday, April 20, 2013 3:55:26 AM UTC-5, Gabrielle wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want

to draw some basic shapes on canvas, which are the elements of flow chart.

Yeah , I’m going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better

and easier to use? I’m a beginer of wxpython. So I need some advice for my

problem.

Welcome to wxPython! The wxPython toolkit provides its own simple graphing widget called PyPlot, which can be found in wx.lib.plot. The wxPython demo shows how to use it. You can also take a look at this old article on the subject: http://www.blog.pythonlibrary.org/2010/09/27/wxpython-pyplot-graphs-with-python/

If you need to do complex plotting, then matplotlib is probably the way to go as it’s much more advanced. Here are a few links:

http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/
http://wiki.wxpython.org/MatplotlibFourierDemo
http://www.scipy.org/Matplotlib_figure_in_a_wx_panel
http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx

Hope that gets you started!
Mike

Thanks for your reply :slight_smile:

I found another thing, that is wx.lib.ogl, it can also draw something on canvas. Do you know what’s the difference between wx.lib.ogl and wx.lib.floatcanvas? Because I found there are many ways to draw in wxPython, but I don’t know which is better for me.

···

On Tuesday, April 23, 2013 4:28:12 AM UTC+8, Che M wrote:

On Sat, Apr 20, 2013 at 4:55 AM, Gabrielle xuan9...@gmail.com wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want

to draw some basic shapes on canvas, which are the elements of flow chart.

Yeah , I’m going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better

and easier to use? I’m a beginer of wxpython. So I need some advice for my

problem.

Welcome!

First, plotCanvas is very old (>7 yrs?) and long-deprecated, as I

understand it. From the Demo:

"PyPlot is an improvement over wxPlotCanvas, which is now deprecated.

If you are using wxPlotCanvas now, please make plans to migrate in

anticipation of the time that wxPlotCanvas disappears completely."

Also, both are for plotting, as in x/y graphs. (Mike, I think you may

have skimmed this post a little too quickly? :D)

So, FloatCanvas would be what you need, I think.

Che

View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032.html

Sent from the wxPython-users mailing list archive at Nabble.com.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Thanks~~

Actually, I’m not familiar with those packages. There is wx.lib.ogl, it related to OGL. But I just wonder, all those packages can help me to draw, which one is the best?

Now, I find that DeviceContext can be used to draw things, so I can use drawing method directly without using wx.lib.floatcanvas or some packages like this. Am I right?

I’m a freshman to program, and I need help of you. What I’m developing is an application that is really in tough, maybe I will ask more in the next.

Thanks again!

BTW, I learned some demos in your GitHub, it’s really helpful :slight_smile:

···

On Tuesday, April 23, 2013 8:23:21 AM UTC+8, Robin Dunn wrote:

Gabrielle wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want

to draw some basic shapes on canvas, which are the elements of flow chart.

Yeah , I’m going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better

and easier to use? I’m a beginer of wxpython. So I need some advice for my

problem.

I think you are comparing apples and oranges, FloatCanvas and PlotCanvas
are not really the same thing. Perhaps you meant FloatCanvas and OGL?
Either way, I think I would probably use FloatCanvas for flow charts in
new development. OGL has had only slight maintenance for a long while now.


Robin Dunn

Software Craftsman

http://wxPython.org

Oops…you’re right, Che. I saw the word “plot” and assumed the OP wanted to know about plotting in wxPython. For some reason, I don’t think of float canvas as a plotting widget.

  • Mike
···

On Monday, April 22, 2013 3:28:12 PM UTC-5, Che M wrote:

On Sat, Apr 20, 2013 at 4:55 AM, Gabrielle xuan9...@gmail.com wrote:

I want to make a scrollable canvas in an GUI written by wxPython, and I want

to draw some basic shapes on canvas, which are the elements of flow chart.

Yeah , I’m going to realize a function to draw flow charts.

Now, I know I can use floatCanvas and plotCanvas, but which one is better

and easier to use? I’m a beginer of wxpython. So I need some advice for my

problem.

Welcome!

First, plotCanvas is very old (>7 yrs?) and long-deprecated, as I

understand it. From the Demo:

"PyPlot is an improvement over wxPlotCanvas, which is now deprecated.

If you are using wxPlotCanvas now, please make plans to migrate in

anticipation of the time that wxPlotCanvas disappears completely."

Also, both are for plotting, as in x/y graphs. (Mike, I think you may

have skimmed this post a little too quickly? :D)

So, FloatCanvas would be what you need, I think.

Che

Gabrielle wrote:

Thanks~~
Actually, I'm not familiar with those packages. There is wx.lib.ogl, it
related to OGL. But I just wonder, all those packages can help me to
draw, which one is the best?

Try them out and see what best fits your needs and abilities.

Now, I find that DeviceContext can be used to draw things,

There is also wx.GraphicsContext. And Cairo can be used from wxPython as well.

so I can use
drawing method directly without using wx.lib.floatcanvas or some
packages like this. Am I right?

Yes, but it is a much lower level API. All it can do is draw, it does not keep track of drawn objects, is not able to manipulate those objects and/or the whole view and automatically redraw, interact with mouse events, etc. You would need to do all of that yourself if you use a lower-level API like wx.DC or wx.GraphicsContext. Higher level APIs like FloatCanvas take care of those kinds of things for you.

···

--
Robin Dunn
Software Craftsman

Thank for your reply, now I know their difference more clear.

By the way, do you know pygame? I think pygame can drawing things easier.
For now, I want to realize a software that can draw things like the link
shows:
https://www.lucidchart.com/documents/edit/4708-145c-517714d1-a330-71940a005abb#?demo=on
The blocks can be dragged into canvas, and we can text in block, resize the
bolck. Draw lines to connect blocks, if the connected block moves, the
connection line also move with this block.

Now I have pygame and wx.lib.floatcanvas as choice. Although pygame is much
better for game, it's methods are clear and easy to use I think. What's
more, I don't know whether wx.lib.floatcanvas can realize the drawing
function that I wanted. Pygame seems easier than Floatcanvas to draw things.

Can you give me some advice about this?
:slight_smile:

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032p5717105.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Gabrielle wrote:

Thank for your reply, now I know their difference more clear.

By the way, do you know pygame? I think pygame can drawing things easier.
For now, I want to realize a software that can draw things like the link
shows:
Lucid visual collaboration suite: Log in
The blocks can be dragged into canvas, and we can text in block, resize the
bolck. Draw lines to connect blocks, if the connected block moves, the
connection line also move with this block.

Now I have pygame and wx.lib.floatcanvas as choice. Although pygame is much
better for game, it's methods are clear and easy to use I think. What's
more, I don't know whether wx.lib.floatcanvas can realize the drawing
function that I wanted. Pygame seems easier than Floatcanvas to draw things.

Can you give me some advice about this?

The best advice I can give is to test them both with a small example of something like what you would want to do in your main project and see which one works better for you.

···

--
Robin Dunn
Software Craftsman

Yeah, maybe it's the best way.
Thanks~

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032p5717153.html
Sent from the wxPython-users mailing list archive at Nabble.com.

I don't thikn PYGame is good fo this sort of thing -- it's great for
animating bitmaps, etc, but that's not what you want.

FloatCanvas would be a pretty good basis for this sort of thing.

Take a look at the sample in:

http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/FloatCanvas/Demos/

for a bunch more examples, in particular:

ProcessDiagram.py

There is also a mailing list for FloatCanvas-specific questions:

http://mail.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

-Chris

···

On Tue, Apr 23, 2013 at 10:53 PM, Gabrielle <xuan901031@gmail.com> wrote:

By the way, do you know pygame? I think pygame can drawing things easier.
For now, I want to realize a software that can draw things like the link
shows:

Lucid visual collaboration suite: Log in
The blocks can be dragged into canvas, and we can text in block, resize the
bolck. Draw lines to connect blocks, if the connected block moves, the
connection line also move with this block.

Now I have pygame and wx.lib.floatcanvas as choice. Although pygame is much
better for game, it's methods are clear and easy to use I think.

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Thanks for your advice.
I considered floatcanvas at first, but its canvas didn't seem good for me.
Then I chose ogl.
I will ask you realated questions if I'm going to use floatcanvas.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/FloatCanvas-and-PlotCanvas-which-is-better-tp5717032p5717209.html
Sent from the wxPython-users mailing list archive at Nabble.com.