Christian Gollwitzer <aurio...@gmx.de> wrote: > Perhaps your assumption is wrong. Maybe the canvas itself *is* resized, > so the white space you see around the image is the background of the > canvas. To test this easily, set a strong color for the background: > > blabla = tk.Canvas(..., bg='red') > > You should see red space appear when you resize the window. If you see > white space, then the options are not set properly and the canvas is not > resized.
I've allready a background by not displayed, so the canvas is not automatilly resized. > > I assume that you want the following: Upon resizing the main window, the > map image should be stretched to fill the space, right? Then you'll have > to do that on your own. First, bind a Configure event to the canvas > > canvas.bind('<Configure>', callback) I do this, the callback is called when window was resized, but unfortunnally i was not able to get the "available space (in pixels)". event.width and event.height just return the actual canvas size... not useful canvas.winfo_width() return the actual canvas size... not useful just note that it works when user resize down, the returned values correspond to the visual portion of the canvas. But do not work when enlarge... canvas.winfo_reqwidth() just return the size when the canvas was originally created... not useful... > > The callback functino now gets called when the canvas needs to be > redrawn. In that callback function, you get the new width and height > from the event object. Resize the image accordingly (using a PIL function). I miss something, here event.width just return me the canvas size, not resized... The full code was on github : <https://github.com/padorange/pmx-bigmap> the tkinter code is in pmx.py the canvas class was TMap GUI was created in main_gui.__init__() callback function was main_gui.resize() -- Pierre-Alain Dorange <http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list