Canvas in wx.ScrolledPanel

Hello list,

I am new here an i need help on something : I am using Matplotlib in the wxPython GUI, and i am trying to draw a BIG canvas, in a SMALL window, which would be scrollable.
My implementation works if i use simple text too long for the size of the window (see example file)
But the problem with the canvas is that is resizes to fit the window, and i would like to be able to draw HUGE figures, which would be scrollable.
(in order print the figure, just uncomment the 3 lines, and comment the wx.StaticText line)

I hope i made my problem clear enough so that someone can help me out.

Thanks in advance!

Thomas.

ps: of course you need to have wxPython installed, i hope some of you have it and can point me in the right direction !

scrolledMatplotlib.py (1.39 KB)

Thomas Coudrat schrieb:

Hello list,

I am new here an i need help on something : I am using Matplotlib in the wxPython GUI, and i am trying to draw a BIG canvas, in a SMALL window, which would be scrollable.
My implementation works if i use simple text too long for the size of the window (see example file)
But the problem with the canvas is that is resizes to fit the window, and i would like to be able to draw HUGE figures, which would be scrollable.
(in order print the figure, just uncomment the 3 lines, and comment the wx.StaticText line)

I hope i made my problem clear enough so that someone can help me out.

Thanks in advance!

It seems to me your implementation already provides what you want. But if you want to show huge figures, you have to make them huge:

fig = matplotlib.figure.Figure(figsize=(10,10))

You could also try to inhibit scaling of the figure, box.Add(canvas, 0, wx.ALL), then the matplotlib figure inside the scrolled panel will always have the same size.

Gregor

Thank you gregor, it is now doing exactly what I want !

Thomas.

···

On Thu, May 14, 2009 at 5:12 AM, Gregor Thalhammer <gregor.thalhammer@…287…> wrote:

Thomas Coudrat schrieb:

Hello list,

I am new here an i need help on something : I am using Matplotlib in the wxPython GUI, and i am trying to draw a BIG canvas, in a SMALL window, which would be scrollable.

My implementation works if i use simple text too long for the size of the window (see example file)

But the problem with the canvas is that is resizes to fit the window, and i would like to be able to draw HUGE figures, which would be scrollable.

(in order print the figure, just uncomment the 3 lines, and comment the wx.StaticText line)

I hope i made my problem clear enough so that someone can help me out.

Thanks in advance!

It seems to me your implementation already provides what you want. But if you want to show huge figures, you have to make them huge:

fig = matplotlib.figure.Figure(figsize=(10,10))

You could also try to inhibit scaling of the figure, box.Add(canvas, 0, wx.ALL), then the matplotlib figure inside the scrolled panel will always have the same size.

Gregor